Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: PSM swap fails when anchor asset is a DAI variant #10655

Open
Jorge-Lopes opened this issue Dec 9, 2024 · 0 comments
Open

Error: PSM swap fails when anchor asset is a DAI variant #10655

Jorge-Lopes opened this issue Dec 9, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Jorge-Lopes
Copy link
Collaborator

Describe the bug

In the context of an a3p-integration acceptance test, an issue occurs during a PSM swap when the asset defined as anchor is either DAI_axl or DAI_grv.

Specifically, the following conditions fail:

  • AmountMath.isGTE(afterFee, wanted), if offer specifies --wantMinted
  • AmountMath.isGTE(maxAnchor, wanted), if offer specifies --giveMinted

This failure results in an error message similar to:

Error#1: wanted { brand: Object [Alleged: IST brand] {}, value: 5_000_000n } is more than { brand: Object [Alleged: DAI_axl brand] {}, value: 5_000_000n } minus fees { brand: Object [Alleged: IST brand] {}, value: 0n }

To Reproduce

Steps to reproduce the behavior:

  1. Go to a3p-integration/proposals/z:acceptance/mintHolder.test.js
  2. Remove slice(2) from line 23
  3. Run the mintHolder.test.js
  4. See error

Expected behavior

The swap should be successfully executed as it happens with USDC and USDT variants.

Platform Environment

OS: macOS Sequoia v15.0.1
Node.js: v20.9.0
Agoric-SDK: agoric-upgrade-16av-1323-gf6aa96c455

Screenshots

Full chain logs
2024-12-09T15:21:59.995Z SwingSet: vat: v43: walletFactory.fromBridge: { blockHeight: 1454, blockTime: 1733757718, owner: 'agoric1ee9hr0jyrxhy999y755mp862ljgycmwyp4pl7q', spendAction: '{"body":"#{\\"method\\":\\"executeOffer\\",\\"offer\\":{\\"id\\":\\"agoric1ee9hr0jyrxhy999y755mp862ljgycmwyp4pl7q-psm-swap-1733757718931\\",\\"invitationSpec\\":{\\"instance\\":\\"$0.Alleged: BoardRemoteInstanceHandle\\",\\"publicInvitationMaker\\":\\"makeWantMintedInvitation\\",\\"source\\":\\"contract\\"},\\"proposal\\":{\\"give\\":{\\"In\\":{\\"brand\\":\\"$1.Alleged: BoardRemoteDAI_axl brand\\",\\"value\\":\\"+5000000\\"}},\\"want\\":{\\"Out\\":{\\"brand\\":\\"$2.Alleged: BoardRemoteIST brand\\",\\"value\\":\\"+5000000\\"}}}}}","slots":["board01867","board05736","board0257"]}', type: 'WALLET_SPEND_ACTION' }
2024-12-09T15:21:59.997Z SwingSet: vat: v43: walletFactory: { wallet: Object [Alleged: SmartWallet self] {}, actionCapData: { body: '#{"method":"executeOffer","offer":{"id":"agoric1ee9hr0jyrxhy999y755mp862ljgycmwyp4pl7q-psm-swap-1733757718931","invitationSpec":{"instance":"$0.Alleged: BoardRemoteInstanceHandle","publicInvitationMaker":"makeWantMintedInvitation","source":"contract"},"proposal":{"give":{"In":{"brand":"$1.Alleged: BoardRemoteDAI_axl brand","value":"+5000000"}},"want":{"Out":{"brand":"$2.Alleged: BoardRemoteIST brand","value":"+5000000"}}}}}', slots: [ 'board01867', 'board05736', 'board0257' ] } }
2024-12-09T15:22:00.066Z SwingSet: vat: v43: wallet agoric1ee9hr0jyrxhy999y755mp862ljgycmwyp4pl7q starting executeOffer agoric1ee9hr0jyrxhy999y755mp862ljgycmwyp4pl7q-psm-swap-1733757718931
2024-12-09T15:22:00.568Z SwingSet: ls: v37: Logging sent error stack (Error#1)
2024-12-09T15:22:00.568Z SwingSet: ls: v37: Error#1: wanted { brand: Object [Alleged: IST brand] {}, value: 5_000_000n } is more than { brand: Object [Alleged: DAI_axl brand] {}, value: 5_000_000n } minus fees { brand: Object [Alleged: IST brand] {}, value: 0n }
2024-12-09T15:22:00.568Z SwingSet: ls: v37: Error: wanted (an object) is more than (an object) minus fees (an object)
at construct ()
at Error (/bundled-source/.../node_modules/ses/src/error/tame-error-constructor.js:56)
at makeError (/bundled-source/.../node_modules/ses/src/error/assert.js:243)
at fail (/bundled-source/.../node_modules/ses/src/error/assert.js:357)
at wantMinted (.../inter-protocol/src/psm/psm.js:302)
at wantMintedHook (.../inter-protocol/src/psm/psm.js:343)
at apply ()
at apply ()
at dispatchToHandler (/bundled-source/.../node_modules/@endo/eventual-send/src/handled-promise.js:163)
at win (/bundled-source/.../node_modules/@endo/eventual-send/src/handled-promise.js:511)
at ()

2024-12-09T15:22:00.569Z SwingSet: ls: v37: Error#1 ERROR_NOTE: Sent as error:liveSlots:v37#70001
2024-12-09T15:22:00.569Z SwingSet: xsnap: v37: Error#1 ERROR_NOTE: Sent as error:liveSlots:v37#70002
2024-12-09T15:22:00.570Z SwingSet: ls: v37: Logging sent error stack (Error#1)
2024-12-09T15:22:00.572Z SwingSet: vat: v43: wallet agoric1ee9hr0jyrxhy999y755mp862ljgycmwyp4pl7q agoric1ee9hr0jyrxhy999y755mp862ljgycmwyp4pl7q-psm-swap-1733757718931 seated
2024-12-09T15:22:00.626Z SwingSet: xsnap: v9: UnhandledPromiseRejectionWarning: (RemoteError(error:liveSlots:v37#70002)#1)
2024-12-09T15:22:00.626Z SwingSet: xsnap: v9: RemoteError(error:liveSlots:v37#70002)#1: wanted (an object) is more than (an object) minus fees (an object)
2024-12-09T15:22:00.626Z SwingSet: xsnap: v9: Error: wanted (an object) is more than (an object) minus fees (an object)
at apply ()
at Error (/bundled-source/.../node_modules/ses/src/error/tame-error-constructor.js:60)
at makeError (/bundled-source/.../node_modules/ses/src/error/assert.js:352)
at decodeErrorCommon (/bundled-source/.../node_modules/@endo/marshal/src/marshal.js:309)
at decodeFromSmallcaps (/bundled-source/.../node_modules/@endo/marshal/src/encodeToSmallcaps.js:437)
at fromCapData (/bundled-source/.../node_modules/@endo/marshal/src/marshal.js:398)
at notifyOnePromise (/bundled-source/.../packages/swingset-liveslots/src/liveslots.js:1043)
at notify (/bundled-source/.../packages/swingset-liveslots/src/liveslots.js:1067)
at dispatchToUserspace (/bundled-source/.../packages/swingset-liveslots/src/liveslots.js:1336)
at runWithoutMetering (/bundled-source/.../packages/swingset-xsnap-supervisor/lib/supervisor-subprocess-xsnap.js:59)
at ()

2024-12-09T15:22:00.682Z SwingSet: xsnap: v9: RemoteError(error:liveSlots:v37#70002)#1 ERROR_NOTE: Sent as error:liveSlots:v9#70001
2024-12-09T15:22:00.682Z SwingSet: ls: v9: Logging sent error stack (RemoteError(error:liveSlots:v37#70002)#1)
2024-12-09T15:22:00.714Z SwingSet: vat: v43: wallet agoric1ee9hr0jyrxhy999y755mp862ljgycmwyp4pl7q offerStatus { id: 'agoric1ee9hr0jyrxhy999y755mp862ljgycmwyp4pl7q-psm-swap-1733757718931', invitationSpec: { instance: Object [Alleged: InstanceHandle] {}, publicInvitationMaker: 'makeWantMintedInvitation', source: 'contract' }, proposal: { give: { In: { brand: Object [Alleged: DAI_axl brand] {}, value: 5_000_000n } }, want: { Out: { brand: Object [Alleged: IST brand] {}, value: 5_000_000n } } }, error: 'Error: wanted (an object) is more than (an object) minus fees (an object)' }
2024-12-09T15:22:00.715Z SwingSet: ls: v43: Logging sent error stack (RemoteError(error:liveSlots:v9#70001)#1)
2024-12-09T15:22:00.716Z SwingSet: ls: v43: RemoteError(error:liveSlots:v9#70001)#1: wanted (an object) is more than (an object) minus fees (an object)
2024-12-09T15:22:00.716Z SwingSet: ls: v43: Error: wanted (an object) is more than (an object) minus fees (an object)
at apply ()
at Error (/bundled-source/.../node_modules/ses/src/error/tame-error-constructor.js:60)
at makeError (/bundled-source/.../node_modules/ses/src/error/assert.js:352)
at decodeErrorCommon (/bundled-source/.../node_modules/@endo/marshal/src/marshal.js:309)
at decodeFromSmallcaps (/bundled-source/.../node_modules/@endo/marshal/src/encodeToSmallcaps.js:437)
at fromCapData (/bundled-source/.../node_modules/@endo/marshal/src/marshal.js:398)
at notifyOnePromise (/bundled-source/.../packages/swingset-liveslots/src/liveslots.js:1043)
at notify (/bundled-source/.../packages/swingset-liveslots/src/liveslots.js:1067)
at dispatchToUserspace (/bundled-source/.../packages/swingset-liveslots/src/liveslots.js:1336)
at runWithoutMetering (/bundled-source/.../packages/swingset-xsnap-supervisor/lib/supervisor-subprocess-xsnap.js:59)
at ()

2024-12-09T15:22:00.716Z SwingSet: ls: v43: RemoteError(error:liveSlots:v9#70001)#1 ERROR_NOTE: Sent as error:liveSlots:v43#70001
2024-12-09T15:22:00.716Z SwingSet: xsnap: v43: RemoteError(error:liveSlots:v9#70001)#1 ERROR_NOTE: Sent as error:liveSlots:v43#70002
2024-12-09T15:22:00.716Z SwingSet: ls: v43: Logging sent error stack (RemoteError(error:liveSlots:v9#70001)#1)
2024-12-09T15:22:00.718Z SwingSet: xsnap: v43: RemoteError(error:liveSlots:v9#70001)#1 ERROR_NOTE: Sent as error:liveSlots:v43#70003
2024-12-09T15:22:00.718Z SwingSet: ls: v43: Logging sent error stack (RemoteError(error:liveSlots:v9#70001)#1)
2024-12-09T15:22:00.723Z SwingSet: xsnap: v43: RemoteError(error:liveSlots:v9#70001)#1 ERROR_NOTE: Sent as error:liveSlots:v43#70004
2024-12-09T15:22:00.723Z SwingSet: ls: v43: Logging sent error stack (RemoteError(error:liveSlots:v9#70001)#1)
2024-12-09T15:22:00.723Z SwingSet: xsnap: v43: RemoteError(error:liveSlots:v9#70001)#1 ERROR_NOTE: Sent as error:liveSlots:v43#70005
2024-12-09T15:22:00.724Z SwingSet: ls: v43: Logging sent error stack (RemoteError(error:liveSlots:v9#70001)#1)
2024-12-09T15:22:00.730Z SwingSet: vat: v43: wallet agoric1ee9hr0jyrxhy999y755mp862ljgycmwyp4pl7q IMMEDIATE OFFER ERROR: (RemoteError(error:liveSlots:v9#70001)#1)
2024-12-09T15:22:00.733Z SwingSet: xsnap: v43: RemoteError(error:liveSlots:v9#70001)#1 ERROR_NOTE: Sent as error:liveSlots:v43#70006
2024-12-09T15:22:00.733Z SwingSet: ls: v43: Logging sent error stack (RemoteError(error:liveSlots:v9#70001)#1)
2024-12-09T15:22:00.746Z SwingSet: ls: v9: Logging sent error stack (RemoteError(error:liveSlots:v37#70001)#2)
2024-12-09T15:22:00.747Z SwingSet: ls: v9: RemoteError(error:liveSlots:v37#70001)#2: wanted (an object) is more than (an object) minus fees (an object)
2024-12-09T15:22:00.747Z SwingSet: ls: v9: Error: wanted (an object) is more than (an object) minus fees (an object)
at apply ()
at Error (/bundled-source/.../node_modules/ses/src/error/tame-error-constructor.js:60)
at makeError (/bundled-source/.../node_modules/ses/src/error/assert.js:352)
at decodeErrorCommon (/bundled-source/.../node_modules/@endo/marshal/src/marshal.js:309)
at decodeFromSmallcaps (/bundled-source/.../node_modules/@endo/marshal/src/encodeToSmallcaps.js:437)
at map ()
at map ()
at fromCapData (/bundled-source/.../node_modules/@endo/marshal/src/marshal.js:398)
at deliver (/bundled-source/.../packages/swingset-liveslots/src/liveslots.js:895)
at dispatchToUserspace (/bundled-source/.../packages/swingset-liveslots/src/liveslots.js:1331)
at runWithoutMetering (/bundled-source/.../packages/swingset-xsnap-supervisor/lib/supervisor-subprocess-xsnap.js:59)
at ()

2024-12-09T15:22:00.747Z SwingSet: ls: v9: RemoteError(error:liveSlots:v37#70001)#2 ERROR_NOTE: Sent as error:liveSlots:v9#70002
2024-12-09T15:22:00.747Z SwingSet: xsnap: v9: RemoteError(error:liveSlots:v37#70001)#2 ERROR_NOTE: Sent as error:liveSlots:v9#70003
2024-12-09T15:22:00.747Z SwingSet: ls: v9: Logging sent error stack (RemoteError(error:liveSlots:v37#70001)#2)
2024-12-09T15:22:00.772Z SwingSet: xsnap: v10: UnhandledPromiseRejectionWarning: (RemoteError(error:liveSlots:v43#70006)#5)
2024-12-09T15:22:00.772Z SwingSet: xsnap: v10: RemoteError(error:liveSlots:v43#70006)#5: wanted (an object) is more than (an object) minus fees (an object)
2024-12-09T15:22:00.772Z SwingSet: xsnap: v10: Error: wanted (an object) is more than (an object) minus fees (an object)
at construct ()
at Error (/bundled-source/.../node_modules/ses/src/error/tame-error-constructor.js:56)
at makeError (/bundled-source/.../node_modules/ses/src/error/assert.js:243)
at decodeErrorCommon (/bundled-source/.../node_modules/@endo/marshal/src/marshal.js:281)
at decodeFromSmallcaps (/bundled-source/.../node_modules/@endo/marshal/src/encodeToSmallcaps.js:434)
at fromCapData (/bundled-source/.../node_modules/@endo/marshal/src/marshal.js:356)
at notifyOnePromise (/bundled-source/.../packages/swingset-liveslots/src/liveslots.js:1225)
at notify (/bundled-source/.../packages/swingset-liveslots/src/liveslots.js:1249)
at dispatchToUserspace (/bundled-source/.../packages/swingset-liveslots/src/liveslots.js:1514)
at runWithoutMetering (/bundled-source/.../packages/swingset-xsnap-supervisor/lib/supervisor-subprocess-xsnap.js:60)
at ()

2024-12-09T15:22:00.776Z SwingSet: vat: v43: wallet agoric1ee9hr0jyrxhy999y755mp862ljgycmwyp4pl7q offerStatus { error: 'Error: wanted (an object) is more than (an object) minus fees (an object)', id: 'agoric1ee9hr0jyrxhy999y755mp862ljgycmwyp4pl7q-psm-swap-1733757718931', invitationSpec: { instance: Object [Alleged: InstanceHandle] {}, publicInvitationMaker: 'makeWantMintedInvitation', source: 'contract' }, proposal: { give: { In: { brand: Object [Alleged: DAI_axl brand] {}, value: 5_000_000n } }, want: { Out: { brand: Object [Alleged: IST brand] {}, value: 5_000_000n } } }, numWantsSatisfied: 0 }
2024-12-09T15:22:00.888Z SwingSet: ls: v21: Logging sent error stack (Error#1)
2024-12-09T15:22:00.888Z SwingSet: ls: v21: Error#1: Object [Alleged: DAI_axl payment] {} was not a live payment for brand Object [Alleged: DAI_axl brand] {} . It could be a used-up payment, a payment for another brand, or it might not be a payment at all.
2024-12-09T15:22:00.889Z SwingSet: ls: v21: Error: (an object) was not a live payment for brand "[Alleged: DAI_axl brand]". It could be a used-up payment, a payment for another brand, or it might not be a payment at all.
at construct ()
at Error (/bundled-source/.../node_modules/ses/src/error/tame-error-constructor.js:56)
at makeError (/bundled-source/.../node_modules/ses/src/error/assert.js:243)
at fail (/bundled-source/.../node_modules/ses/src/error/assert.js:357)
at assertLivePayment (.../ertp/src/paymentLedger.js:239)
at burn (.../ertp/src/paymentLedger.js:364)
at apply ()
at apply ()
at ()

2024-12-09T15:22:00.889Z SwingSet: ls: v21: Error#1 ERROR_NOTE: Sent as error:liveSlots:v21#70001
2024-12-09T15:22:00.903Z SwingSet: ls: v14: Logging sent error stack (RemoteError(error:liveSlots:v21#70001)#2)
2024-12-09T15:22:00.903Z SwingSet: ls: v14: RemoteError(error:liveSlots:v21#70001)#2: (an object) was not a live payment for brand "[Alleged: DAI_axl brand]". It could be a used-up payment, a payment for another brand, or it might not be a payment at all.
2024-12-09T15:22:00.904Z SwingSet: ls: v14: Error: (an object) was not a live payment for brand "[Alleged: DAI_axl brand]". It could be a used-up payment, a payment for another brand, or it might not be a payment at all.
at construct ()
at Error (/bundled-source/.../node_modules/ses/src/error/tame-error-constructor.js:56)
at makeError (/bundled-source/.../node_modules/ses/src/error/assert.js:243)
at decodeErrorCommon (/bundled-source/.../node_modules/@endo/marshal/src/marshal.js:281)
at decodeFromSmallcaps (/bundled-source/.../node_modules/@endo/marshal/src/encodeToSmallcaps.js:434)
at fromCapData (/bundled-source/.../node_modules/@endo/marshal/src/marshal.js:356)
at notifyOnePromise (/bundled-source/.../packages/swingset-liveslots/src/liveslots.js:1225)
at notify (/bundled-source/.../packages/swingset-liveslots/src/liveslots.js:1249)
at dispatchToUserspace (/bundled-source/.../packages/swingset-liveslots/src/liveslots.js:1514)
at runWithoutMetering (/bundled-source/.../packages/swingset-xsnap-supervisor/lib/supervisor-subprocess-xsnap.js:60)
at ()

2024-12-09T15:22:00.904Z SwingSet: ls: v14: RemoteError(error:liveSlots:v21#70001)#2 ERROR_NOTE: Sent as error:liveSlots:v14#70002
2024-12-09T15:22:01.386Z SwingSet: vat: v43: wallet agoric1ee9hr0jyrxhy999y755mp862ljgycmwyp4pl7q offerStatus { error: 'Error: wanted (an object) is more than (an object) minus fees (an object)', id: 'agoric1ee9hr0jyrxhy999y755mp862ljgycmwyp4pl7q-psm-swap-1733757718931', invitationSpec: { instance: Object [Alleged: InstanceHandle] {}, publicInvitationMaker: 'makeWantMintedInvitation', source: 'contract' }, numWantsSatisfied: 0, proposal: { give: { In: { brand: Object [Alleged: DAI_axl brand] {}, value: 5_000_000n } }, want: { Out: { brand: Object [Alleged: IST brand] {}, value: 5_000_000n } } }, payouts: { In: { brand: Object [Alleged: DAI_axl brand] {}, value: 5_000_000n }, Out: { brand: Object [Alleged: IST brand] {}, value: 0n } } }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant