Giter Club home page Giter Club logo

arbitrum-orbit-sdk's People

Contributors

chrstph-dvx avatar douglance avatar fionnachan avatar greatsoshiant avatar jason-w123 avatar spsjvc avatar tucksondev 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arbitrum-orbit-sdk's Issues

chainId lookup in createRollupFetchTransactionHash always evaluates to false

When I ran this code with publicClient for Sepolia it seems like it always evaluated to false, and hence fromBlock was always set to "earliest"

Using the more verbose way worked for me:

  var found = false;
  for (const key in earliestRollupCreatorDeploymentBlockNumber) {
    if (chainId.toString() == key) {
      found = true;
      break;
    }
  }
  const fromBlock = found ? earliestRollupCreatorDeploymentBlockNumber[chainId] : 'earliest';

Note: I was looking into createRollupFetchTransactionHash because the call to publicClient.getLogs can fail for many RPC endpoints that limit the number of blocks you can query. This function can be improved to loop on getLogs and avoid the problem.

ERROR : error when start node nitro use config create from "example/create-rollup-eth"

hi guys, i try to start my nitro node use config created from sdk "example/create-rollup-eth", but when i start nitro node i received error

``nitro_1 | INFO [05-26|15:54:51.730] created jwt file filename=/root/.arbitrum/jwtsecret
nitro_1 | INFO [05-26|15:54:51.730] Running Arbitrum nitro node revision=development vcs.time=development
nitro_1 | INFO [05-26|15:54:52.044] connected to l1 chain l1url=https://sepolia-rollup.arbitrum.io/rpc l1chainid=421,614
nitro_1 | INFO [05-26|15:54:52.044] retaining ability to lookup full transaction history as archive mode is enabled
nitro_1 | ERROR[05-26|15:54:52.273] unable to find validator machine directory for the on-chain WASM module root err="stat /home/user/target/machines/0x8b104a2e80ac6165dc58b9048de12f301d70b02a0ab51396c22b4b4b802a16a4: no such file or directory"
what i can do to fix that ?

Numeric Overflow when calculating gas in `createTokenBridge-ethers`

When using gas overrides for retryables in createTokenBridge-ethers - the gas calculations are liable to overflow because they are converted to normal javascript numbers instead of strings and then into BigNumbers.

Here is a quick script I wrote to reproduce this:

import { JsonRpcProvider } from '@ethersproject/providers'
import { RollupAdminLogic__factory } from '@arbitrum/sdk/dist/lib/abi/factories/RollupAdminLogic__factory'
import { defineChain, createPublicClient, http, Address } from 'viem'
import { privateKeyToAccount } from 'viem/accounts'
import { createTokenBridgePrepareTransactionRequest } from '@arbitrum/orbit-sdk';
import { sanitizePrivateKey } from '@arbitrum/orbit-sdk/utils'

function createPublicClientFromChainInfo({
  id,
  name,
  rpcUrl,
}: {
  id: number
  name: string
  rpcUrl: string
}) {
  const chain = defineChain({
    id: id,
    network: name,
    name: name,
    nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
    rpcUrls: {
      default: {
        http: [rpcUrl],
      },
      public: {
        http: [rpcUrl],
      },
    },
    testnet: true,
  })

  return createPublicClient({ chain, transport: http() })
}

async function main() {
  const baseChainRpc = 'https://public.stackup.sh/api/v1/node/ethereum-sepolia	'
  const childChainRpc = 'https://rpc-safe-arb-final-test-ldcnti87cp.t.conduit-stg.xyz'
  const rollupAddress = "0xAB903c1E98694F23B12C710fEc6FEa8f0696d4b3"
  const baseChainDeployerKey = "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"



  const l1Provider = new JsonRpcProvider(baseChainRpc)
  const l1NetworkInfo = await l1Provider.getNetwork()

  const l2Provider = new JsonRpcProvider(childChainRpc)
  const l2NetworkInfo = await l2Provider.getNetwork()

  const deployer = privateKeyToAccount(sanitizePrivateKey(baseChainDeployerKey))
  const rollup = RollupAdminLogic__factory.connect(rollupAddress, l1Provider)

  const parentChainPublicClient = createPublicClientFromChainInfo({
    id: l1NetworkInfo.chainId,
    name: l1NetworkInfo.name,
    rpcUrl: baseChainRpc,
  })

  const orbitChainPublicClient = createPublicClientFromChainInfo({
    id: l2NetworkInfo.chainId,
    name: l2NetworkInfo.name,
    rpcUrl: childChainRpc,
  })

  const txRequest = await createTokenBridgePrepareTransactionRequest({
    params: {
      rollup: rollupAddress as Address,
      rollupOwner: deployer.address,
    },
    parentChainPublicClient,
    orbitChainPublicClient,
    account: deployer.address,
    gasOverrides: {
      gasLimit: {
        percentIncrease: 1000n,
      },
    },
    retryableGasOverrides: {
      maxSubmissionCostForFactory: {
        percentIncrease: 1000n,
      },
      maxGasForFactory: {
        percentIncrease: 1000n,
      },
      maxSubmissionCostForContracts: {
        percentIncrease: 1000n,
      },
      maxGasForContracts: {
        percentIncrease: 1000n,
      },
    },
  })
}
main()

and the trace it produces:

Error: overflow [ See: https://links.ethers.org/v5-errors-NUMERIC_FAULT-overflow ] (fault="overflow", operation="toNumber", value="24748619995277248", code=NUMERIC_FAULT, version=bignumber/5.7.0)
    at Logger.makeError (/Users/drewtada/conduit/orbit-setup-script/node_modules/@ethersproject/logger/src.ts/index.ts:269:28)
    at Logger.throwError (/Users/drewtada/conduit/orbit-setup-script/node_modules/@ethersproject/logger/src.ts/index.ts:281:20)
    at throwFault (/Users/drewtada/conduit/orbit-setup-script/node_modules/@ethersproject/bignumber/src.ts/bignumber.ts:356:19)
    at BigNumber.toNumber (/Users/drewtada/conduit/orbit-setup-script/node_modules/@ethersproject/bignumber/src.ts/bignumber.ts:186:13)
    at createTokenBridgeGetInputs (/Users/drewtada/conduit/orbit-setup-script/node_modules/@arbitrum/orbit-sdk/dist/createTokenBridge-ethers.js:53:62)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async createTokenBridgePrepareTransactionRequest (/Users/drewtada/conduit/orbit-setup-script/node_modules/@arbitrum/orbit-sdk/dist/createTokenBridgePrepareTransactionRequest.js:14:67)
    at async main (/Users/drewtada/conduit/orbit-setup-script/scripts/test.ts:65:21) {
  reason: 'overflow',
  code: 'NUMERIC_FAULT',
  fault: 'overflow',
  operation: 'toNumber',
  value: '24748619995277248'
}

Note that if you comment out the gasOverrides and retryableGasOverrides it should work

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.