-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
YAS 277 Logarithmic-time JUMP transpilation #69
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a good first pass!
Left a few comments to improve the performance and readability. It sounds like this works, but I'm concerned about the tech debt of reinventing the wheel. If we find a bug in any of this, we will need to take a while to familiarize ourselves with the code before being able to debug it.
For instance, if using a standard BST, even someone not familiar with the code but familiar with data structures can print it, easily tell if something is wrong, and know immediately where to fix it. With the tree created here, we first need to figure out how it works in order to tell if it has actually been assembled correctly, and then we need to read through the non-standard code assembling it to figure out where we might be able to fix it.
packages/rollup-dev-tools/src/tools/transpiler/binary-search-tree.ts
Outdated
Show resolved
Hide resolved
packages/rollup-dev-tools/src/tools/transpiler/binary-search-tree.ts
Outdated
Show resolved
Hide resolved
packages/rollup-dev-tools/src/tools/transpiler/binary-search-tree.ts
Outdated
Show resolved
Hide resolved
/** | ||
* Generates a binary search tree based on a set of keys to search against, and values associated with each key. | ||
* | ||
* @param keys The (lowest-to-highest) ordered array of keys to be searched for. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will return without error if the conditions documented here are not met. Bare minimum, should throw if assumptions aren't met, even better, automatically fix it, doing the sorting here instead of in every caller.
values: number[] | ||
): BinarySearchNode[] => { | ||
// initialize our array of all tree nodes, populating first with all the leaves | ||
let allTreeNodes: BinarySearchNode[] = keys.map((v, i) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should check to make sure keys.length === values.length
. An easy way to do that is to just declare the input type:
export interface NumericMap {
[key: number]: number
}
That changes your map to
Object.keys(input)
.sort((a, b) => a < b ? -1 : a === b ? 0 : 1 )
.map((key, i) => {
return {
key,
value: input[i],
nodeId: i,
}
})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leaving without this check for now as we do it in jump-replacement.ts
already, if you think that sounds reasonable
packages/rollup-dev-tools/src/tools/transpiler/binary-search-tree.ts
Outdated
Show resolved
Hide resolved
packages/rollup-dev-tools/src/tools/transpiler/binary-search-tree.ts
Outdated
Show resolved
Hide resolved
packages/rollup-dev-tools/src/tools/transpiler/binary-search-tree.ts
Outdated
Show resolved
Hide resolved
packages/rollup-dev-tools/src/tools/transpiler/binary-search-tree.ts
Outdated
Show resolved
Hide resolved
packages/rollup-dev-tools/src/tools/transpiler/binary-search-tree.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Would pull out two functions (listed in comments) to make it read a bit more clearly, but this is much better!
...[ | ||
// DUP the value to match without deleting it forever | ||
{ | ||
opcode: Opcode.DUP1, | ||
consumedBytes: undefined, | ||
}, | ||
// Compare to JUMPDEST before | ||
getPUSHIntegerOp(node.value.jumpdestBefore), | ||
{ | ||
opcode: Opcode.EQ, | ||
consumedBytes: undefined, | ||
}, | ||
// If match, we will send the JUMPDEST after to the success block | ||
getPUSHIntegerOp(node.value.jumpdestAfter), | ||
{ | ||
opcode: Opcode.SWAP1, | ||
consumedBytes: undefined, | ||
}, | ||
// PUSH success block location (via a tag--will be filled out later) | ||
{ | ||
opcode: getPUSHOpcode(maxBytesOfContractSize), | ||
consumedBytes: Buffer.alloc(maxBytesOfContractSize), | ||
tag: { | ||
padPUSH: false, | ||
reasonTagged: IS_PUSH_MATCH_SUCCESS_LOC, | ||
metadata: undefined, | ||
}, | ||
}, | ||
// JUMPI to success block if match | ||
{ | ||
opcode: Opcode.JUMPI, | ||
consumedBytes: undefined, | ||
}, | ||
// POP the JUMPDESTafter if not a match. | ||
{ | ||
opcode: Opcode.POP, | ||
consumedBytes: undefined, | ||
}, | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would create a helper function for this. It'll make the logic read more clearly:
if (isRightNode) {
bytecodeToReturn.push(generateBinarySearchTreeNodeJumpdest(node))
}
bytecodeToReturn.push(generateNodeEqualityCheckBytecode(...))
if (!node.left && !node.right) {
// stop
}
bytecodeToReturn.push(generateCheckIfGreaterAndJumpToRightChildBytecode(...))
bytecodeToReturn.push(
...getBytecodeForSubtreeRoot(node.left, false),
...getBytecodeForSubtreeRoot(node.right, true)
)
return bytecodeToReturn
if (node.right) { | ||
bytecodeToReturn.push( | ||
...[ | ||
{ | ||
opcode: Opcode.DUP1, | ||
consumedBytes: undefined, | ||
}, | ||
// PUSH the key to be compared to determine which node to proceed to | ||
getPUSHIntegerOp(node.value.jumpdestBefore), | ||
// Compare the keys | ||
{ | ||
opcode: Opcode.LT, | ||
consumedBytes: undefined, | ||
}, | ||
// PUSH a *placeholder* for the destination of thde right child to be JUMPed to if check passes--to be set later | ||
{ | ||
opcode: getPUSHOpcode(maxBytesOfContractSize), | ||
consumedBytes: Buffer.alloc(maxBytesOfContractSize), | ||
tag: { | ||
padPUSH: false, | ||
reasonTagged: IS_PUSH_BINARY_SEARCH_NODE_LOCATION, | ||
metadata: { node }, | ||
}, | ||
}, | ||
// JUMP if the LT check passed | ||
{ | ||
opcode: Opcode.JUMPI, | ||
consumedBytes: undefined, | ||
}, | ||
] | ||
) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would create a helper function for this. It'll make the logic read more clearly:
if (isRightNode) {
bytecodeToReturn.push(generateBinarySearchTreeNodeJumpdest(node))
}
bytecodeToReturn.push(generateNodeEqualityCheckBytecode(...))
if (!node.left && !node.right) {
// stop
}
bytecodeToReturn.push(generateCheckIfGreaterAndJumpToRightChildBytecode(...))
bytecodeToReturn.push(
...getBytecodeForSubtreeRoot(node.left, false),
...getBytecodeForSubtreeRoot(node.right, true)
)
return bytecodeToReturn
* @returns The success bytecode. | ||
*/ | ||
|
||
export const getJumpIndexSwitchStatementSuccessJumpdestBytecode = (): EVMBytecode => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe rename to getJumpFoundSuccessfullyJumpdestIndexBytecode
now that it's not a switch and the algo is not relevant?
* set EOA implementation slot to deaddeaddead.... * fix tests
* feat: add superchain erc20 bridge (#61) * feat: add superchain erc20 bridge * fix: interfaces and versions * refactor: optimism superchain erc20 redesign (#62) * refactor: use oz upgradeable erc20 as dependency * chore: update interfaces * fix: tests based on changes * refactor: remove op as dependency * feat: add check for supererc20 bridge on modifier * chore: update tests and interfaces * chore: update stack vars name on test * chore: remove empty gitmodules file * chore: update superchain weth errors * test: add superchain erc20 bridge tests (#65) * test: add superchain erc20 bridge tests * test: add optimism superchain erc20 beacon tests * test: remove unnecessary test * test: tests fixes * test: tests fixes * chore: update missing bridge on natspec (#69) * chore: update missing bridge on natspec * fix: natspecs --------- Co-authored-by: agusduha <[email protected]> * fix: remove superchain erc20 base (#70) * refactor: update isuperchainweth (#71) --------- Co-authored-by: agusduha <[email protected]> * feat: rename mint/burn and add SuperchainERC20 (#74) * refactor: rename mint and burn functions on superchain erc20 * chore: rename optimism superchain erc20 to superchain erc20 * feat: create optimism superchain erc20 contract * chore: update natspec and errors * fix: superchain erc20 tests * refactor: make superchain erc20 abstract * refactor: move storage and erc20 metadata functions to implementation * chore: update interfaces * chore: update superchain erc20 events * fix: tests * fix: natspecs * fix: add semmver lock and snapshots * fix: remove unused imports * fix: natspecs --------- Co-authored-by: 0xDiscotech <[email protected]> * fix: refactor zero check (#76) * fix: pre pr * fix: semver natspec check failure (#79) * fix: semver natspec check failure * fix: ignore mock contracts in semver natspec script * fix: error message * feat: add crosschain erc20 interface (#80) * feat: add crosschain erc20 interface * fix: refactor interfaces * fix: superchain bridge natspec (#83) * fix: superchain weth natspec (#84) Co-authored-by: 0xng <[email protected]> Co-authored-by: 0xParticle <[email protected]> Co-authored-by: gotzenx <[email protected]> * fix: stop inheriting superchain interfaces (#85) * fix: stop inheriting superchain interfaces * fix: move events and erros into the implementation * fix: make superchainERC20 inherits from crosschainERC20 * fix: superchain bridge rename (#86) * fix: fee vault compiler error (#87) * fix: remove unused imports * fix: refactor common errors (#90) * fix: refactor common errors * fix: remove unused version * fix: reuse unauthorized error (#92) * fix: superchain erc20 factory conflicts * fix: rename crosschain functions (#94) --------- Co-authored-by: Disco <[email protected]> Co-authored-by: 0xng <[email protected]> Co-authored-by: 0xParticle <[email protected]> Co-authored-by: gotzenx <[email protected]>
* chore: update missing bridge on natspec * fix: natspecs --------- Co-authored-by: agusduha <[email protected]>
* feat: add superchain erc20 bridge (#61) * feat: add superchain erc20 bridge * fix: interfaces and versions * refactor: optimism superchain erc20 redesign (#62) * refactor: use oz upgradeable erc20 as dependency * chore: update interfaces * fix: tests based on changes * refactor: remove op as dependency * feat: add check for supererc20 bridge on modifier * chore: update tests and interfaces * chore: update stack vars name on test * chore: remove empty gitmodules file * chore: update superchain weth errors * test: add superchain erc20 bridge tests (#65) * test: add superchain erc20 bridge tests * test: add optimism superchain erc20 beacon tests * test: remove unnecessary test * test: tests fixes * test: tests fixes * chore: update missing bridge on natspec (#69) * chore: update missing bridge on natspec * fix: natspecs --------- Co-authored-by: agusduha <[email protected]> * fix: remove superchain erc20 base (#70) * refactor: update isuperchainweth (#71) --------- Co-authored-by: agusduha <[email protected]> * feat: rename mint/burn and add SuperchainERC20 (#74) * refactor: rename mint and burn functions on superchain erc20 * chore: rename optimism superchain erc20 to superchain erc20 * feat: create optimism superchain erc20 contract * chore: update natspec and errors * fix: superchain erc20 tests * refactor: make superchain erc20 abstract * refactor: move storage and erc20 metadata functions to implementation * chore: update interfaces * chore: update superchain erc20 events * fix: tests * fix: natspecs * fix: add semmver lock and snapshots * fix: remove unused imports * fix: natspecs --------- Co-authored-by: 0xDiscotech <[email protected]> * fix: refactor zero check (#76) * fix: pre pr * fix: semver natspec check failure (#79) * fix: semver natspec check failure * fix: ignore mock contracts in semver natspec script * fix: error message * feat: add crosschain erc20 interface (#80) * feat: add crosschain erc20 interface * fix: refactor interfaces * fix: superchain bridge natspec (#83) * fix: superchain weth natspec (#84) Co-authored-by: 0xng <[email protected]> Co-authored-by: 0xParticle <[email protected]> Co-authored-by: gotzenx <[email protected]> * fix: stop inheriting superchain interfaces (#85) * fix: stop inheriting superchain interfaces * fix: move events and erros into the implementation * fix: make superchainERC20 inherits from crosschainERC20 * fix: superchain bridge rename (#86) * fix: fee vault compiler error (#87) * fix: remove unused imports * fix: refactor common errors (#90) * fix: refactor common errors * fix: remove unused version * feat: add cross domain context function * fix: reuse unauthorized error (#92) * fix: superchain erc20 factory conflicts * fix: rename crosschain functions (#94) * chore: run pre-pr * chore: run pre-pr * fix: mocked calls on tests * feat: add cross domain message context function (#98) ---- Co-Authored-by: AgusDuha <[email protected]> --------- Co-authored-by: AgusDuha <[email protected]> Co-authored-by: agusduha <[email protected]> Co-authored-by: 0xng <[email protected]> Co-authored-by: 0xParticle <[email protected]> Co-authored-by: gotzenx <[email protected]>
* feat: add superchain erc20 bridge (#61) * feat: add superchain erc20 bridge * fix: interfaces and versions * refactor: optimism superchain erc20 redesign (#62) * refactor: use oz upgradeable erc20 as dependency * chore: update interfaces * fix: tests based on changes * refactor: remove op as dependency * feat: add check for supererc20 bridge on modifier * chore: update tests and interfaces * chore: update stack vars name on test * chore: remove empty gitmodules file * chore: update superchain weth errors * test: add superchain erc20 bridge tests (#65) * test: add superchain erc20 bridge tests * test: add optimism superchain erc20 beacon tests * test: remove unnecessary test * test: tests fixes * test: tests fixes * chore: update missing bridge on natspec (#69) * chore: update missing bridge on natspec * fix: natspecs --------- Co-authored-by: agusduha <[email protected]> * fix: remove superchain erc20 base (#70) * refactor: update isuperchainweth (#71) --------- Co-authored-by: agusduha <[email protected]> * feat: rename mint/burn and add SuperchainERC20 (#74) * refactor: rename mint and burn functions on superchain erc20 * chore: rename optimism superchain erc20 to superchain erc20 * feat: create optimism superchain erc20 contract * chore: update natspec and errors * fix: superchain erc20 tests * refactor: make superchain erc20 abstract * refactor: move storage and erc20 metadata functions to implementation * chore: update interfaces * chore: update superchain erc20 events * fix: tests * fix: natspecs * fix: add semmver lock and snapshots * fix: remove unused imports * fix: natspecs --------- Co-authored-by: 0xDiscotech <[email protected]> * fix: refactor zero check (#76) * fix: pre pr * fix: semver natspec check failure (#79) * fix: semver natspec check failure * fix: ignore mock contracts in semver natspec script * fix: error message * feat: add crosschain erc20 interface (#80) * feat: add crosschain erc20 interface * fix: refactor interfaces * fix: superchain bridge natspec (#83) * fix: superchain weth natspec (#84) Co-authored-by: 0xng <[email protected]> Co-authored-by: 0xParticle <[email protected]> Co-authored-by: gotzenx <[email protected]> * fix: stop inheriting superchain interfaces (#85) * fix: stop inheriting superchain interfaces * fix: move events and erros into the implementation * fix: make superchainERC20 inherits from crosschainERC20 * fix: superchain bridge rename (#86) * fix: fee vault compiler error (#87) * fix: remove unused imports * fix: refactor common errors (#90) * fix: refactor common errors * fix: remove unused version * fix: reuse unauthorized error (#92) * fix: superchain erc20 factory conflicts * fix: rename crosschain functions (#94) * feat: superweth redesign * fix: pr fixes * fix: fixes post merge --------- Co-authored-by: Disco <[email protected]> Co-authored-by: 0xng <[email protected]> Co-authored-by: 0xParticle <[email protected]> Co-authored-by: gotzenx <[email protected]>
* feat: SuperchainWETH redesign (#101) * feat: add superchain erc20 bridge (#61) * feat: add superchain erc20 bridge * fix: interfaces and versions * refactor: optimism superchain erc20 redesign (#62) * refactor: use oz upgradeable erc20 as dependency * chore: update interfaces * fix: tests based on changes * refactor: remove op as dependency * feat: add check for supererc20 bridge on modifier * chore: update tests and interfaces * chore: update stack vars name on test * chore: remove empty gitmodules file * chore: update superchain weth errors * test: add superchain erc20 bridge tests (#65) * test: add superchain erc20 bridge tests * test: add optimism superchain erc20 beacon tests * test: remove unnecessary test * test: tests fixes * test: tests fixes * chore: update missing bridge on natspec (#69) * chore: update missing bridge on natspec * fix: natspecs --------- Co-authored-by: agusduha <[email protected]> * fix: remove superchain erc20 base (#70) * refactor: update isuperchainweth (#71) --------- Co-authored-by: agusduha <[email protected]> * feat: rename mint/burn and add SuperchainERC20 (#74) * refactor: rename mint and burn functions on superchain erc20 * chore: rename optimism superchain erc20 to superchain erc20 * feat: create optimism superchain erc20 contract * chore: update natspec and errors * fix: superchain erc20 tests * refactor: make superchain erc20 abstract * refactor: move storage and erc20 metadata functions to implementation * chore: update interfaces * chore: update superchain erc20 events * fix: tests * fix: natspecs * fix: add semmver lock and snapshots * fix: remove unused imports * fix: natspecs --------- Co-authored-by: 0xDiscotech <[email protected]> * fix: refactor zero check (#76) * fix: pre pr * fix: semver natspec check failure (#79) * fix: semver natspec check failure * fix: ignore mock contracts in semver natspec script * fix: error message * feat: add crosschain erc20 interface (#80) * feat: add crosschain erc20 interface * fix: refactor interfaces * fix: superchain bridge natspec (#83) * fix: superchain weth natspec (#84) Co-authored-by: 0xng <[email protected]> Co-authored-by: 0xParticle <[email protected]> Co-authored-by: gotzenx <[email protected]> * fix: stop inheriting superchain interfaces (#85) * fix: stop inheriting superchain interfaces * fix: move events and erros into the implementation * fix: make superchainERC20 inherits from crosschainERC20 * fix: superchain bridge rename (#86) * fix: fee vault compiler error (#87) * fix: remove unused imports * fix: refactor common errors (#90) * fix: refactor common errors * fix: remove unused version * fix: reuse unauthorized error (#92) * fix: superchain erc20 factory conflicts * fix: rename crosschain functions (#94) * feat: superweth redesign * fix: pr fixes * fix: fixes post merge --------- Co-authored-by: Disco <[email protected]> Co-authored-by: 0xng <[email protected]> Co-authored-by: 0xParticle <[email protected]> Co-authored-by: gotzenx <[email protected]> * fix: SuperchainWETH redesign fixes (#110) * fix: superchainWETH redesign fixes * fix: withdraw arg * fix: fix revert in SuperchainWETH tests (#112) --------- Co-authored-by: AgusDuha <[email protected]> Co-authored-by: Disco <[email protected]> Co-authored-by: 0xng <[email protected]> Co-authored-by: 0xParticle <[email protected]> Co-authored-by: agusduha <[email protected]>
…rc20 implementation (#12476) * feat: add superchain erc20 bridge (#61) * feat: add superchain erc20 bridge * fix: interfaces and versions * refactor: optimism superchain erc20 redesign (#62) * refactor: use oz upgradeable erc20 as dependency * chore: update interfaces * fix: tests based on changes * refactor: remove op as dependency * feat: add check for supererc20 bridge on modifier * chore: update tests and interfaces * chore: update stack vars name on test * chore: remove empty gitmodules file * chore: update superchain weth errors * test: add superchain erc20 bridge tests (#65) * test: add superchain erc20 bridge tests * test: add optimism superchain erc20 beacon tests * test: remove unnecessary test * test: tests fixes * test: tests fixes * chore: update missing bridge on natspec (#69) * chore: update missing bridge on natspec * fix: natspecs --------- Co-authored-by: agusduha <[email protected]> * fix: remove superchain erc20 base (#70) * refactor: update isuperchainweth (#71) --------- Co-authored-by: agusduha <[email protected]> * feat: rename mint/burn and add SuperchainERC20 (#74) * refactor: rename mint and burn functions on superchain erc20 * chore: rename optimism superchain erc20 to superchain erc20 * feat: create optimism superchain erc20 contract * chore: update natspec and errors * fix: superchain erc20 tests * refactor: make superchain erc20 abstract * refactor: move storage and erc20 metadata functions to implementation * chore: update interfaces * chore: update superchain erc20 events * fix: tests * fix: natspecs * fix: add semmver lock and snapshots * fix: remove unused imports * fix: natspecs --------- Co-authored-by: 0xDiscotech <[email protected]> * fix: refactor zero check (#76) * fix: pre pr * chore: add new solady version and import it for erc20 * fix: undo forge std changes * chore: re run pre pr script * fix: semver natspec check failure (#79) * fix: semver natspec check failure * fix: ignore mock contracts in semver natspec script * fix: error message * feat: add crosschain erc20 interface (#80) * feat: add crosschain erc20 interface * fix: refactor interfaces * fix: superchain bridge natspec (#83) * fix: superchain weth natspec (#84) Co-authored-by: 0xng <[email protected]> Co-authored-by: 0xParticle <[email protected]> Co-authored-by: gotzenx <[email protected]> * fix: stop inheriting superchain interfaces (#85) * fix: stop inheriting superchain interfaces * fix: move events and erros into the implementation * fix: make superchainERC20 inherits from crosschainERC20 * fix: superchain bridge rename (#86) * fix: fee vault compiler error (#87) * fix: remove unused imports * chore: run pre-pr and update vendor interface * fix: refactor common errors (#90) * fix: refactor common errors * fix: remove unused version * feat: add permit2 on optimism superchain erc20 * chore: run pre-pr script * fix: reuse unauthorized error (#92) * fix: superchain erc20 factory conflicts * fix: rename crosschain functions (#94) * chore: run pre-pr * chore: run pre-pr * chore: run pre-pr * feat: add new tests on optimism superchain erc20 * fix: vars and params naming on newly added tests * fix: var name * feat: support permit2 on optimism superchain erc20 and upgrade solady's erc20 implementation (#97) --- Co-Authored-by: AgusDuha <[email protected]> * chore: use ierc20 alias for ierc20 solady interface (#108) --------- Co-authored-by: AgusDuha <[email protected]> Co-authored-by: agusduha <[email protected]> Co-authored-by: 0xng <[email protected]> Co-authored-by: 0xParticle <[email protected]> Co-authored-by: gotzenx <[email protected]>
…-optimism#12321) * feat: add superchain erc20 bridge (ethereum-optimism#61) * feat: add superchain erc20 bridge * fix: interfaces and versions * refactor: optimism superchain erc20 redesign (ethereum-optimism#62) * refactor: use oz upgradeable erc20 as dependency * chore: update interfaces * fix: tests based on changes * refactor: remove op as dependency * feat: add check for supererc20 bridge on modifier * chore: update tests and interfaces * chore: update stack vars name on test * chore: remove empty gitmodules file * chore: update superchain weth errors * test: add superchain erc20 bridge tests (ethereum-optimism#65) * test: add superchain erc20 bridge tests * test: add optimism superchain erc20 beacon tests * test: remove unnecessary test * test: tests fixes * test: tests fixes * chore: update missing bridge on natspec (ethereum-optimism#69) * chore: update missing bridge on natspec * fix: natspecs --------- Co-authored-by: agusduha <[email protected]> * fix: remove superchain erc20 base (ethereum-optimism#70) * refactor: update isuperchainweth (ethereum-optimism#71) --------- Co-authored-by: agusduha <[email protected]> * feat: rename mint/burn and add SuperchainERC20 (ethereum-optimism#74) * refactor: rename mint and burn functions on superchain erc20 * chore: rename optimism superchain erc20 to superchain erc20 * feat: create optimism superchain erc20 contract * chore: update natspec and errors * fix: superchain erc20 tests * refactor: make superchain erc20 abstract * refactor: move storage and erc20 metadata functions to implementation * chore: update interfaces * chore: update superchain erc20 events * fix: tests * fix: natspecs * fix: add semmver lock and snapshots * fix: remove unused imports * fix: natspecs --------- Co-authored-by: 0xDiscotech <[email protected]> * fix: refactor zero check (ethereum-optimism#76) * fix: pre pr * fix: semver natspec check failure (ethereum-optimism#79) * fix: semver natspec check failure * fix: ignore mock contracts in semver natspec script * fix: error message * feat: add crosschain erc20 interface (ethereum-optimism#80) * feat: add crosschain erc20 interface * fix: refactor interfaces * fix: superchain bridge natspec (ethereum-optimism#83) * fix: superchain weth natspec (ethereum-optimism#84) Co-authored-by: 0xng <[email protected]> Co-authored-by: 0xParticle <[email protected]> Co-authored-by: gotzenx <[email protected]> * fix: stop inheriting superchain interfaces (ethereum-optimism#85) * fix: stop inheriting superchain interfaces * fix: move events and erros into the implementation * fix: make superchainERC20 inherits from crosschainERC20 * fix: superchain bridge rename (ethereum-optimism#86) * fix: fee vault compiler error (ethereum-optimism#87) * fix: remove unused imports * fix: refactor common errors (ethereum-optimism#90) * fix: refactor common errors * fix: remove unused version * fix: reuse unauthorized error (ethereum-optimism#92) * fix: superchain erc20 factory conflicts * fix: rename crosschain functions (ethereum-optimism#94) --------- Co-authored-by: Disco <[email protected]> Co-authored-by: 0xng <[email protected]> Co-authored-by: 0xParticle <[email protected]> Co-authored-by: gotzenx <[email protected]>
) * feat: add superchain erc20 bridge (ethereum-optimism#61) * feat: add superchain erc20 bridge * fix: interfaces and versions * refactor: optimism superchain erc20 redesign (ethereum-optimism#62) * refactor: use oz upgradeable erc20 as dependency * chore: update interfaces * fix: tests based on changes * refactor: remove op as dependency * feat: add check for supererc20 bridge on modifier * chore: update tests and interfaces * chore: update stack vars name on test * chore: remove empty gitmodules file * chore: update superchain weth errors * test: add superchain erc20 bridge tests (ethereum-optimism#65) * test: add superchain erc20 bridge tests * test: add optimism superchain erc20 beacon tests * test: remove unnecessary test * test: tests fixes * test: tests fixes * chore: update missing bridge on natspec (ethereum-optimism#69) * chore: update missing bridge on natspec * fix: natspecs --------- Co-authored-by: agusduha <[email protected]> * fix: remove superchain erc20 base (ethereum-optimism#70) * refactor: update isuperchainweth (ethereum-optimism#71) --------- Co-authored-by: agusduha <[email protected]> * feat: rename mint/burn and add SuperchainERC20 (ethereum-optimism#74) * refactor: rename mint and burn functions on superchain erc20 * chore: rename optimism superchain erc20 to superchain erc20 * feat: create optimism superchain erc20 contract * chore: update natspec and errors * fix: superchain erc20 tests * refactor: make superchain erc20 abstract * refactor: move storage and erc20 metadata functions to implementation * chore: update interfaces * chore: update superchain erc20 events * fix: tests * fix: natspecs * fix: add semmver lock and snapshots * fix: remove unused imports * fix: natspecs --------- Co-authored-by: 0xDiscotech <[email protected]> * fix: refactor zero check (ethereum-optimism#76) * fix: pre pr * fix: semver natspec check failure (ethereum-optimism#79) * fix: semver natspec check failure * fix: ignore mock contracts in semver natspec script * fix: error message * feat: add crosschain erc20 interface (ethereum-optimism#80) * feat: add crosschain erc20 interface * fix: refactor interfaces * fix: superchain bridge natspec (ethereum-optimism#83) * fix: superchain weth natspec (ethereum-optimism#84) Co-authored-by: 0xng <[email protected]> Co-authored-by: 0xParticle <[email protected]> Co-authored-by: gotzenx <[email protected]> * fix: stop inheriting superchain interfaces (ethereum-optimism#85) * fix: stop inheriting superchain interfaces * fix: move events and erros into the implementation * fix: make superchainERC20 inherits from crosschainERC20 * fix: superchain bridge rename (ethereum-optimism#86) * fix: fee vault compiler error (ethereum-optimism#87) * fix: remove unused imports * fix: refactor common errors (ethereum-optimism#90) * fix: refactor common errors * fix: remove unused version * feat: add cross domain context function * fix: reuse unauthorized error (ethereum-optimism#92) * fix: superchain erc20 factory conflicts * fix: rename crosschain functions (ethereum-optimism#94) * chore: run pre-pr * chore: run pre-pr * fix: mocked calls on tests * feat: add cross domain message context function (ethereum-optimism#98) ---- Co-Authored-by: AgusDuha <[email protected]> --------- Co-authored-by: AgusDuha <[email protected]> Co-authored-by: agusduha <[email protected]> Co-authored-by: 0xng <[email protected]> Co-authored-by: 0xParticle <[email protected]> Co-authored-by: gotzenx <[email protected]>
* feat: SuperchainWETH redesign (ethereum-optimism#101) * feat: add superchain erc20 bridge (ethereum-optimism#61) * feat: add superchain erc20 bridge * fix: interfaces and versions * refactor: optimism superchain erc20 redesign (ethereum-optimism#62) * refactor: use oz upgradeable erc20 as dependency * chore: update interfaces * fix: tests based on changes * refactor: remove op as dependency * feat: add check for supererc20 bridge on modifier * chore: update tests and interfaces * chore: update stack vars name on test * chore: remove empty gitmodules file * chore: update superchain weth errors * test: add superchain erc20 bridge tests (ethereum-optimism#65) * test: add superchain erc20 bridge tests * test: add optimism superchain erc20 beacon tests * test: remove unnecessary test * test: tests fixes * test: tests fixes * chore: update missing bridge on natspec (ethereum-optimism#69) * chore: update missing bridge on natspec * fix: natspecs --------- Co-authored-by: agusduha <[email protected]> * fix: remove superchain erc20 base (ethereum-optimism#70) * refactor: update isuperchainweth (ethereum-optimism#71) --------- Co-authored-by: agusduha <[email protected]> * feat: rename mint/burn and add SuperchainERC20 (ethereum-optimism#74) * refactor: rename mint and burn functions on superchain erc20 * chore: rename optimism superchain erc20 to superchain erc20 * feat: create optimism superchain erc20 contract * chore: update natspec and errors * fix: superchain erc20 tests * refactor: make superchain erc20 abstract * refactor: move storage and erc20 metadata functions to implementation * chore: update interfaces * chore: update superchain erc20 events * fix: tests * fix: natspecs * fix: add semmver lock and snapshots * fix: remove unused imports * fix: natspecs --------- Co-authored-by: 0xDiscotech <[email protected]> * fix: refactor zero check (ethereum-optimism#76) * fix: pre pr * fix: semver natspec check failure (ethereum-optimism#79) * fix: semver natspec check failure * fix: ignore mock contracts in semver natspec script * fix: error message * feat: add crosschain erc20 interface (ethereum-optimism#80) * feat: add crosschain erc20 interface * fix: refactor interfaces * fix: superchain bridge natspec (ethereum-optimism#83) * fix: superchain weth natspec (ethereum-optimism#84) Co-authored-by: 0xng <[email protected]> Co-authored-by: 0xParticle <[email protected]> Co-authored-by: gotzenx <[email protected]> * fix: stop inheriting superchain interfaces (ethereum-optimism#85) * fix: stop inheriting superchain interfaces * fix: move events and erros into the implementation * fix: make superchainERC20 inherits from crosschainERC20 * fix: superchain bridge rename (ethereum-optimism#86) * fix: fee vault compiler error (ethereum-optimism#87) * fix: remove unused imports * fix: refactor common errors (ethereum-optimism#90) * fix: refactor common errors * fix: remove unused version * fix: reuse unauthorized error (ethereum-optimism#92) * fix: superchain erc20 factory conflicts * fix: rename crosschain functions (ethereum-optimism#94) * feat: superweth redesign * fix: pr fixes * fix: fixes post merge --------- Co-authored-by: Disco <[email protected]> Co-authored-by: 0xng <[email protected]> Co-authored-by: 0xParticle <[email protected]> Co-authored-by: gotzenx <[email protected]> * fix: SuperchainWETH redesign fixes (ethereum-optimism#110) * fix: superchainWETH redesign fixes * fix: withdraw arg * fix: fix revert in SuperchainWETH tests (ethereum-optimism#112) --------- Co-authored-by: AgusDuha <[email protected]> Co-authored-by: Disco <[email protected]> Co-authored-by: 0xng <[email protected]> Co-authored-by: 0xParticle <[email protected]> Co-authored-by: agusduha <[email protected]>
…rc20 implementation (ethereum-optimism#12476) * feat: add superchain erc20 bridge (ethereum-optimism#61) * feat: add superchain erc20 bridge * fix: interfaces and versions * refactor: optimism superchain erc20 redesign (ethereum-optimism#62) * refactor: use oz upgradeable erc20 as dependency * chore: update interfaces * fix: tests based on changes * refactor: remove op as dependency * feat: add check for supererc20 bridge on modifier * chore: update tests and interfaces * chore: update stack vars name on test * chore: remove empty gitmodules file * chore: update superchain weth errors * test: add superchain erc20 bridge tests (ethereum-optimism#65) * test: add superchain erc20 bridge tests * test: add optimism superchain erc20 beacon tests * test: remove unnecessary test * test: tests fixes * test: tests fixes * chore: update missing bridge on natspec (ethereum-optimism#69) * chore: update missing bridge on natspec * fix: natspecs --------- Co-authored-by: agusduha <[email protected]> * fix: remove superchain erc20 base (ethereum-optimism#70) * refactor: update isuperchainweth (ethereum-optimism#71) --------- Co-authored-by: agusduha <[email protected]> * feat: rename mint/burn and add SuperchainERC20 (ethereum-optimism#74) * refactor: rename mint and burn functions on superchain erc20 * chore: rename optimism superchain erc20 to superchain erc20 * feat: create optimism superchain erc20 contract * chore: update natspec and errors * fix: superchain erc20 tests * refactor: make superchain erc20 abstract * refactor: move storage and erc20 metadata functions to implementation * chore: update interfaces * chore: update superchain erc20 events * fix: tests * fix: natspecs * fix: add semmver lock and snapshots * fix: remove unused imports * fix: natspecs --------- Co-authored-by: 0xDiscotech <[email protected]> * fix: refactor zero check (ethereum-optimism#76) * fix: pre pr * chore: add new solady version and import it for erc20 * fix: undo forge std changes * chore: re run pre pr script * fix: semver natspec check failure (ethereum-optimism#79) * fix: semver natspec check failure * fix: ignore mock contracts in semver natspec script * fix: error message * feat: add crosschain erc20 interface (ethereum-optimism#80) * feat: add crosschain erc20 interface * fix: refactor interfaces * fix: superchain bridge natspec (ethereum-optimism#83) * fix: superchain weth natspec (ethereum-optimism#84) Co-authored-by: 0xng <[email protected]> Co-authored-by: 0xParticle <[email protected]> Co-authored-by: gotzenx <[email protected]> * fix: stop inheriting superchain interfaces (ethereum-optimism#85) * fix: stop inheriting superchain interfaces * fix: move events and erros into the implementation * fix: make superchainERC20 inherits from crosschainERC20 * fix: superchain bridge rename (ethereum-optimism#86) * fix: fee vault compiler error (ethereum-optimism#87) * fix: remove unused imports * chore: run pre-pr and update vendor interface * fix: refactor common errors (ethereum-optimism#90) * fix: refactor common errors * fix: remove unused version * feat: add permit2 on optimism superchain erc20 * chore: run pre-pr script * fix: reuse unauthorized error (ethereum-optimism#92) * fix: superchain erc20 factory conflicts * fix: rename crosschain functions (ethereum-optimism#94) * chore: run pre-pr * chore: run pre-pr * chore: run pre-pr * feat: add new tests on optimism superchain erc20 * fix: vars and params naming on newly added tests * fix: var name * feat: support permit2 on optimism superchain erc20 and upgrade solady's erc20 implementation (ethereum-optimism#97) --- Co-Authored-by: AgusDuha <[email protected]> * chore: use ierc20 alias for ierc20 solady interface (ethereum-optimism#108) --------- Co-authored-by: AgusDuha <[email protected]> Co-authored-by: agusduha <[email protected]> Co-authored-by: 0xng <[email protected]> Co-authored-by: 0xParticle <[email protected]> Co-authored-by: gotzenx <[email protected]>
Description
Introduces a binary search tree in place of the switch case Jump table logic to reduce gas overhead. WIP as it needs some comments and other structural shifts, but core functionality is there and all integrations seem to pass.
Questions
validateJumpBytecode
simply because it was hard to reproduce that functionality with this new structure. Hopefully rigorous integration tests (turns out the originaljump-integration.spec.ts
was missingawaits
and completely useless) make up for this, but if someone can think of a way to duplicate whatvalidateJumpBytecode
was doing, happy to add back. @willmeister maybe you're best to give a recommendation there :)Metadata
Fixes
Contributing Agreement