Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
5edae3f6
Commit
5edae3f6
authored
Feb 28, 2023
by
clabby
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expect the delegatecalls
parent
02dcda75
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
2 deletions
+5
-2
.gas-snapshot
packages/contracts-bedrock/.gas-snapshot
+1
-1
ResolvedDelegateProxy.t.sol
...tracts-bedrock/contracts/test/ResolvedDelegateProxy.t.sol
+4
-1
No files found.
packages/contracts-bedrock/.gas-snapshot
View file @
5edae3f6
...
@@ -393,7 +393,7 @@ RLPWriter_writeUint_Test:test_writeUint_smallint4_succeeds() (gas: 7302)
...
@@ -393,7 +393,7 @@ RLPWriter_writeUint_Test:test_writeUint_smallint4_succeeds() (gas: 7302)
RLPWriter_writeUint_Test:test_writeUint_smallint_succeeds() (gas: 7280)
RLPWriter_writeUint_Test:test_writeUint_smallint_succeeds() (gas: 7280)
RLPWriter_writeUint_Test:test_writeUint_zero_succeeds() (gas: 7749)
RLPWriter_writeUint_Test:test_writeUint_zero_succeeds() (gas: 7749)
ResolvedDelegateProxy_Test:test_fallback_addressManagerNotSet_reverts() (gas: 605906)
ResolvedDelegateProxy_Test:test_fallback_addressManagerNotSet_reverts() (gas: 605906)
ResolvedDelegateProxy_Test:test_fallback_delegateCallBar_reverts() (gas: 2
1927
)
ResolvedDelegateProxy_Test:test_fallback_delegateCallBar_reverts() (gas: 2
4783
)
ResourceMetering_Test:test_meter_initialResourceParams_succeeds() (gas: 8983)
ResourceMetering_Test:test_meter_initialResourceParams_succeeds() (gas: 8983)
ResourceMetering_Test:test_meter_updateNoGasDelta_succeeds() (gas: 2008142)
ResourceMetering_Test:test_meter_updateNoGasDelta_succeeds() (gas: 2008142)
ResourceMetering_Test:test_meter_updateOneEmptyBlock_succeeds() (gas: 18369)
ResourceMetering_Test:test_meter_updateOneEmptyBlock_succeeds() (gas: 18369)
...
...
packages/contracts-bedrock/contracts/test/ResolvedDelegateProxy.t.sol
View file @
5edae3f6
...
@@ -7,12 +7,13 @@ import { ResolvedDelegateProxy } from "../legacy/ResolvedDelegateProxy.sol";
...
@@ -7,12 +7,13 @@ import { ResolvedDelegateProxy } from "../legacy/ResolvedDelegateProxy.sol";
contract ResolvedDelegateProxy_Test is Test {
contract ResolvedDelegateProxy_Test is Test {
AddressManager internal addressManager;
AddressManager internal addressManager;
SimpleImplementation internal impl;
SimpleImplementation internal proxy;
SimpleImplementation internal proxy;
function setUp() public {
function setUp() public {
// Set up the address manager.
// Set up the address manager.
addressManager = new AddressManager();
addressManager = new AddressManager();
SimpleImplementation
impl = new SimpleImplementation();
impl = new SimpleImplementation();
addressManager.setAddress("SimpleImplementation", address(impl));
addressManager.setAddress("SimpleImplementation", address(impl));
// Set up the proxy.
// Set up the proxy.
...
@@ -23,12 +24,14 @@ contract ResolvedDelegateProxy_Test is Test {
...
@@ -23,12 +24,14 @@ contract ResolvedDelegateProxy_Test is Test {
// Tests that the proxy properly bubbles up returndata when the delegatecall succeeds.
// Tests that the proxy properly bubbles up returndata when the delegatecall succeeds.
function testFuzz_fallback_delegateCallFoo_succeeds(uint256 x) public {
function testFuzz_fallback_delegateCallFoo_succeeds(uint256 x) public {
vm.expectCall(address(impl), abi.encodeWithSelector(impl.foo.selector, x));
assertEq(proxy.foo(x), x);
assertEq(proxy.foo(x), x);
}
}
// Tests that the proxy properly bubbles up returndata when the delegatecall reverts.
// Tests that the proxy properly bubbles up returndata when the delegatecall reverts.
function test_fallback_delegateCallBar_reverts() public {
function test_fallback_delegateCallBar_reverts() public {
vm.expectRevert("SimpleImplementation: revert");
vm.expectRevert("SimpleImplementation: revert");
vm.expectCall(address(impl), abi.encodeWithSelector(impl.bar.selector));
proxy.bar();
proxy.bar();
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment