Giter Site home page Giter Site logo

opengsn / workshop Goto Github PK

View Code? Open in Web Editor NEW
31.0 31.0 24.0 202 KB

About A sample project to how how to add GSN to a simple Web3 project. See the PRs to see the needed changes. NOTE: the video was created for a previous version

Home Page: https://youtu.be/tb4hkbofmou

License: GNU General Public License v3.0

Solidity 17.11% JavaScript 66.42% Shell 4.12% HTML 12.35%

workshop's People

Contributors

drortirosh avatar web3dopamine avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

workshop's Issues

Failed to relay call

@drortirosh, after successfully running yarn gsn-with-ganache and yarn start

image

image

When I click on Capture the flag button, I receive errors in the browser console

Console output

calling sendAsync{"method":"eth_sendTransaction","params":[{"gas":"0xb1bb","gasPrice":"0x4a817c800","from":"0x90f8bf6a479f320ead074411a4b0e7944ea8c9c1","to":"0xfc628dd79137395f3c9744e33b1c5de554d94882","data":"0x239e26f2"}],"id":66,"jsonrpc":"2.0"} bundle.js:61918 fetchRelaysAdded: found 1 relays bundle.js:47566 Sending in view mode: {"jsonrpc":"2.0","id":1,"method":"eth_call","params":[{"from":"0x0000000000000000000000000000000000000000","to":"0xC89Ce4735882C9F0f0FE26686c53074E09B0D550","gas":"0xb71b00","data":"0xb1a62e720000000000000000000000000000000000000000000000000000000000b71b000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000003200000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000016000000000000000000000000090f8bf6a479f320ead074411a4b0e7944ea8c9c1000000000000000000000000fc628dd79137395f3c9744e33b1c5de554d948820000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b1bb000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000063e108dc0000000000000000000000000000000000000000000000000000000000000004239e26f20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004a817c80000000000000000000000000000000000000000000000000000000004a817c800000000000000000000000000000000000000000000000000000000000000176c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d833215cbcc3f914bd1c9ece3ee7bf8b14f841bb000000000000000000000000254dffcd3277c0b1660f6d42efbb754edababc2b00000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","gasPrice":"0x4a817c800"},"latest"]} encoded data: {"relayRequest":{"request":{"to":"0xfc628dd79137395f3c9744e33b1c5de554d94882","data":"0x239e26f2","from":"0x90f8bf6a479f320ead074411a4b0e7944ea8c9c1","value":"0","nonce":"0","gas":"45499","validUntilTime":"1675692252"},"relayData":{"relayWorker":"0x0000000000000000000000000000000000000000","transactionCalldataGasUsed":"0x176c","paymasterData":"0x","maxFeePerGas":"20000000000","maxPriorityFeePerGas":"20000000000","paymaster":"0xD833215cBcc3f914bD1C9ece3EE7BF8B14f841bb","clientId":"1","forwarder":"0x254dffcd3277C0b1660F6d42EFbB754edaBAbC2B"}},"signature":"0x","approvalData":"0x","maxAcceptanceBudget":"12000000"} bundle.js:47584 relayCall res=0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000f142fc1e9c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000 bundle.js:63097 nextRelay: find fastest relay from: [{"relayManager":"0xc6232031bF6C4858e7BC9eb3e253dBB45C58ef7D","relayUrl":"http://127.0.0.1:36869"}] bundle.js:63153 getRelayAddressPing URL: http://127.0.0.1:36869 bundle.js:63099 race finished with a result: {"errors":{"dataType":"Map","value":[["http://127.0.0.1:36869",{"message":"Network Error","name":"Error","stack":"Error: Network Error\n at createError (http://localhost:3000/bundle.js:68018:15)\n at XMLHttpRequest.handleError (http://localhost:3000/bundle.js:67537:14)","config":{"url":"http://127.0.0.1:36869/getaddr?paymaster=0xD833215cBcc3f914bD1C9ece3EE7BF8B14f841bb","method":"get","headers":{"Accept":"application/json, text/plain, */*"},"transformRequest":[null],"transformResponse":[null],"timeout":15000,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","maxContentLength":-1,"maxBodyLength":-1,"transitional":{"silentJSONParsing":true,"forcedJSONParsing":true,"clarifyTimeoutError":false}}}]]},"results":[]}

Error

image

Prevsiously when running yarn start command I was facing below error
Public state variable has override specified but does not override anything. solidity

Becauase in line# 18 string public override versionRecipient = "3.0.0"; the override specifier is used.

To eliminate this error I removed the override specifier because compiler says that I am not overriding anything

So now line# 18 is: string public versionRecipient = "3.0.0";

Than yarn start worked fine.

Below is CaptureTheFlag.sol

/**
 * SPDX-License-Identifier:MIT
 */
pragma solidity ^0.8.7;

import "@opengsn/contracts/src/ERC2771Recipient.sol";

contract CaptureTheFlag is ERC2771Recipient {

    event FlagCaptured(address previousHolder, address currentHolder);

    address public currentHolder = address(0);

    constructor(address forwarder) {
        _setTrustedForwarder(forwarder);
    }

    string public versionRecipient = "3.0.0";

    function captureTheFlag() external {
        address previousHolder = currentHolder;

        currentHolder = _msgSender();

        emit FlagCaptured(previousHolder, currentHolder);
    }
}

Unable to start GSN

Hi,

I try to make npx gsn start and returns me this error:

...
Naive Paymaster successfully funded, balance: 1
Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:71:19)
    at Object.createHash (node:crypto:133:10)
    at hash160 (/home/ivanmmurcia/Desktop/workshop-GSN/node_modules/ethereum-cryptography/vendor/hdkey-without-crypto.js:249:21)
    at HDKey.set (/home/ivanmmurcia/Desktop/workshop-GSN/node_modules/ethereum-cryptography/vendor/hdkey-without-crypto.js:50:24)
    at Function.HDKey.fromMasterSeed (/home/ivanmmurcia/Desktop/workshop-GSN/node_modules/ethereum-cryptography/vendor/hdkey-without-crypto.js:194:20)
    at Function.EthereumHDKey.fromMasterSeed (/home/ivanmmurcia/Desktop/workshop-GSN/node_modules/ethereumjs-wallet/hdkey.js:20:26)
    at new KeyManager (/home/ivanmmurcia/Desktop/workshop-GSN/node_modules/@opengsn/relay/src/KeyManager.ts:60:26)
    at GsnTestEnvironmentClass._runServer (/home/ivanmmurcia/Desktop/workshop-GSN/node_modules/@opengsn/cli/src/GsnTestEnvironment.ts:174:31)
    at GsnTestEnvironmentClass.startGsn (/home/ivanmmurcia/Desktop/workshop-GSN/node_modules/@opengsn/cli/src/GsnTestEnvironment.ts:86:16)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at /home/ivanmmurcia/Desktop/workshop-GSN/node_modules/@opengsn/cli/src/commands/gsn-start.ts:18:17 {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'

Manjaro Linux; Build ID: rolling 64 bits
Truffle v5.6.0 (core: 5.6.0)
Ganache v7.4.3
Solidity - 0.8.17 (solc-js)
Node v18.10.0
Web3.js v1.7.4

Missing second argument when using WhitelistPaymaster.sol

Hi Open GSN team,
I just want you to fix a bug when using whitelistpaymaster.

on line 18 on migrations\2_deploy_contracts.js the address 0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1 is expected to be whitelisted but a second boolean argument must be sent which is missing.
It is fixed on my side, let me know if I can create a pull request. I will be happy to do it :D.

Fail to relay calls:

Hi,
I'm trying to relay calls on polygon using a custom paymaster which already been funded however i get the following error:

Relaying errors (1):
https://polygon.3-0-0-beta-3.opengsn.org/v3 => local view call to 'relayCall()' reverted: view call to 'relayCall' reverted in client: {"code":-32603,"message":"Internal JSON-RPC error.","data":{"code":-32000,"message":"err: insufficient funds for gas * price + value: address 0x434EFBCA662f6F846f8DeC3fdE52Fac4c8792e03 have 2550816605859437982 want 3273095523480000000 (supplied gas 12000000)"}} stack:Error: local view call to 'relayCall()' reverted: view call to 'relayCall' reverted in client: {"code":-32603,"message":"Internal JSON-RPC error.","data":{"code":-32000,"message":"err: insufficient funds for gas * price + value: address 0x434EFBCA662f6F846f8DeC3fdE52Fac4c8792e03 have 2550816605859437982 want 3273095523480000000 (supplied gas 12000000)"}}

I'm using the following configuration:
{logLevel: 'debug'},
paymasterAddress: '0xFcA1200C2f42197539b70d17714eEf98D1af8204',
performDryRunViewRelayCall: false,
minMaxPriorityFeePerGas: 82716215680,
// maxViewableGasLimit: '3157770248985000000',

        }

I've tried to set the maxViewableGasLimit but nothing helped.

Failed to execute `yarn gsn-with-ganache`

$ yarn gsn-with-ganache
...
Setting minimum stake of 1 TestWeth on Hub
Setting minimum stake of 0.000000000000000001 wEth
Naive Paymaster successfully funded, balance: 1
Registering GSN relayer at http://127.0.0.1:35287
Error: Request failed with status code 503
    at createError (/home/aping/git/workshop/node_modules/axios/lib/core/createError.js:16:15)
    at settle (/home/aping/git/workshop/node_modules/axios/lib/core/settle.js:17:12)
    at IncomingMessage.handleStreamEnd (/home/aping/git/workshop/node_modules/axios/lib/adapters/http.js:269:11)
    at IncomingMessage.emit (node:events:525:35)
    at endReadableNT (node:internal/streams/readable:1359:12)
    at processTicksAndRejections (node:internal/process/task_queues:82:21) {
  config: {
    url: 'http://127.0.0.1:35287/getaddr',
    method: 'get',
    headers: {
      Accept: 'application/json, text/plain, */*',
      'Content-Type': 'application/json',
      'User-Agent': 'axios/0.21.4',
      host: '127.0.0.1:35287'
  

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.