offchainlabs / arbitrum-orbit-sdk Goto Github PK
View Code? Open in Web Editor NEW๐ SDK for building Arbitrum Orbit chains
License: Apache License 2.0
๐ SDK for building Arbitrum Orbit chains
License: Apache License 2.0
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.
function createRollupFetchTransactionHash(rollup: Address)
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 ?
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
The instantiation of the OrbitHandler in the verify-token-bridge script is likely missing the parent RPC, here:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.