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

Wallet can sign an offer without requiring a roundtrip to the chain #3908

Closed
rowgraus opened this issue Sep 29, 2021 · 5 comments
Closed

Wallet can sign an offer without requiring a roundtrip to the chain #3908

rowgraus opened this issue Sep 29, 2021 · 5 comments
Assignees
Labels
performance Performance related issues read-no-tx topic: reading from the chain without a transaction wallet
Milestone

Comments

@rowgraus
Copy link

rowgraus commented Sep 29, 2021

Acceptance Criteria:

  • After clicking Swap on the AMM, offer arrives in the wallet within 3 seconds
@rowgraus rowgraus added this to the Mainnet: Phase 1 - Treasury Launch milestone Sep 29, 2021
@dckc
Copy link
Member

dckc commented Sep 29, 2021

I wonder if what @dtribble just describes works for the voting case: #3901

I also wonder how this compares to web3 APIs.

@rowgraus
Copy link
Author

Acceptance Criteria:

  • After clicking Swap on the AMM, offer arrives in the wallet within 3 seconds

@rowgraus rowgraus changed the title Wallet can make an offer without requiring a roundtrip to the chain Wallet can sign an offer without requiring a roundtrip to the chain Oct 8, 2021
@dckc dckc added the performance Performance related issues label Oct 22, 2021
@Tartuffo Tartuffo added the MN-1 label Jan 21, 2022
@Tartuffo Tartuffo removed the MN-1 label Feb 7, 2022
@Tartuffo Tartuffo removed this from the Mainnet: Phase 1 - RUN Protocol milestone Feb 8, 2022
@Tartuffo Tartuffo added this to the Mainnet 1 milestone Mar 23, 2022
@dckc dckc added the read-no-tx topic: reading from the chain without a transaction label May 31, 2022
@dckc
Copy link
Member

dckc commented Jun 15, 2022

status quo:

sequenceDiagram
    dApp->>bridge: getPublicFacet
    bridge->>dApp: publicFacet
    dApp->>publicFacet: getVaultInvitation
    publicFacet->>dApp: invitation
    dApp->>bridge: addOffer(invitation, ...)
    bridge->>user: ok?
    user->>bridge: ok.
    bridge->>zoe: offer(invitation, ...)
Loading

design sketch:

sequenceDiagram
    dApp->>bridge: addOffer({contractPub: "board2342", method: "makeVaultInvitation", give, want})
    bridge->>user: {give, want...} ok?
    user->>bridge: ok.
    bridge->>SmartWallet: addOffer({public: "board2342", method: "makeVaultInvitation"})
    SmartWallet->>zoe: getPublicFacet
    zoe->>SmartWallet: publicFacet
    SmartWallet->>publicFacet: getVaultInvitation
    SmartWallet->>zoe: offer(invitation, ...)
Loading

@dckc
Copy link
Member

dckc commented Jun 17, 2022

refinement, based on discussion with @michaelfig

sequenceDiagram

participant user
participant RPC
participant walletUI
participant walletSt
participant walletB
participant dApp

    walletUI->>RPC: ?: published.wallet.agoric1..
    RPC-->>walletUI: stateN
    dApp->>+walletB: leader = makeLeader(wk-url)
      note left of dApp: creates an iframe to well-known url powerbox.agoric.app
    dApp->>dApp: f = makeFollower(leader)
    dApp->>dApp: c = leader.makeClient()
    dApp->>walletB: f.next()
    walletB->>walletSt: getDappState
    user->>walletUI: approve dApp
    walletSt-->>walletB: filter(stateN, dApp)
    walletB-->>dApp: filter(stateN, dApp)
    note left of dApp: stateN includes services.board, .zoe
    dApp->>walletB: instanceP <- E(E(client).getBoard()).getValue('asdf')
    dApp->>walletB: pfP <- E(E(client).getZoe()).getPublicFacet(instanceP)
    user->>dApp: send me tokens
    dApp->>walletB: invP <- E(pfP).makeInvitation()
    dApp->>walletB: E(c).deposit(invP)
    dApp->>walletB: offerIdP <- E(c).propose({want: 5tok})
    note right of walletB: offerId is edge name e.g.: 45
    walletB->>walletUI: proposal
    note right of walletUI: hits storage
    walletUI->>user: proposal
    user->>walletUI: Approve
    walletUI->>RPC: tx([trivialActions, acceptZoeOffer])
    RPC->>walletUI: stateN'
    walletUI->>walletSt: stateN'
    walletSt->>walletB: stateN'
    note right of walletB: stateN' includes offerstates
    walletB->>dApp: filter(stateN', dApp)
 
Loading

Description of the Design

dapp will use @agoric/casting library to interact with the wallet front-end. (currently uses @endo/captp)

casting has

  • a single store for outbound messages (= current state of the stream)
  • a single store for inbound messages (= requests to change the state of the stream)
    • can only influence state of stream; not much response; only a broken promise on connection failure; no tx failure notice
    • promises can be pipelines, but you can't get values from them other than by following the stream

transaction manager (TODO: replace with relevant DB terminology)

  • strict
  • speculative
  • optimistic

@dckc
Copy link
Member

dckc commented Aug 15, 2022

fixed by #5946

@dckc dckc closed this as completed Aug 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Performance related issues read-no-tx topic: reading from the chain without a transaction wallet
Projects
None yet
Development

No branches or pull requests

5 participants