Coder Social home page Coder Social logo

Comments (7)

lijiang2087 avatar lijiang2087 commented on June 7, 2024

💪1️⃣💎

from one-wallet.

polymorpher avatar polymorpher commented on June 7, 2024

A third alternative is to alter 1 and validate signature differently, if the sender of the transaction is a contract. Since StakingTransaction relies on (r, s, v) signature values to calculate the sender's address, we should be extend StakingTransaction to accept a new type of StakingMsg and to include the contract's address, as well as the proof needed for validation. The validation of proof can be a call to a function on the contract (isValidSignature per EIP-1271), or hard-coded in Go similar to the flow in https://github.com/polymorpher/one-wallet/blob/master/code/contracts/ONEWallet.sol#L171.

At runtime, the client submits the staking request directly via hmy_sendrawstakingtransaction RPC call using the altered StakingTransaction structure proposed above.

This alternative requires much less modification compared to (2). It does not venture into customizing EVM and only customizes components that are already customized (RPC servers).

from one-wallet.

rlan35 avatar rlan35 commented on June 7, 2024

A third alternative is to alter 1 and validate signature differently, if the sender of the transaction is a contract. Since StakingTransaction relies on (r, s, v) signature values to calculate the sender's address, we should be extend StakingTransaction to accept a new type of StakingMsg and to include the contract's address, as well as the proof needed for validation. The validation of proof can be a call to a function on the contract (isValidSignature per EIP-1271), or hard-coded in Go similar to the flow in https://github.com/polymorpher/one-wallet/blob/master/code/contracts/ONEWallet.sol#L171.

At runtime, the client submits the staking request directly via hmy_sendrawstakingtransaction RPC call using the altered StakingTransaction structure proposed above.

This alternative requires much less modification compared to (2). It does not venture into customizing EVM and only customizes components that are already customized (RPC servers).

The 3rd option is a viable option but it seems to me very hacky. It's altering staking txn structure and also staking txn validation logic, which is as heavy-weight as option 2 I think (the difference is it's not touching evm). Actually I think the option 2 is more elegant and generic and will help all other smart contract staking operations. I would prefer to go with option 2 even though it may take more time to implement.

Btw, we are making good progress on account abstraction: harmony-one/bounties#35. Though I don't think it will save us from having to change the staking logic on our side.

from one-wallet.

hashmesan avatar hashmesan commented on June 7, 2024

Btw, we are making good progress on account abstraction: harmony-one/bounties#35. Though I don't think it will save us from having to change the staking logic on our side.

@rlan35 When do you think it will be ready on testnet or mainnet?

from one-wallet.

polymorpher avatar polymorpher commented on June 7, 2024

Gnosis Safe is sort of handling contract signatures via options 3, by accepting the case that v=0 and using a variable length signature. See https://github.com/gnosis/safe-contracts/blob/34c87b783dfd04ff09ef7c358c3182c3c151e086/contracts/GnosisSafe.sol#L257

from one-wallet.

polymorpher avatar polymorpher commented on June 7, 2024

As of today, delegate and undelegate are added as smart contract functions (pre-compiled) on Harmony. Staking support on 1wallet is set to be added in mid March. harmony-one/harmony#3906

from one-wallet.

polymorpher avatar polymorpher commented on June 7, 2024

Fixed by #268

from one-wallet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.