Skip to content

Commit

Permalink
Merge branch 'master' into tarekkma/fix-fee-treasury-propotion
Browse files Browse the repository at this point in the history
  • Loading branch information
TarekkMA authored Nov 14, 2024
2 parents 8c01ec5 + d184125 commit d549395
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 2 deletions.
5 changes: 5 additions & 0 deletions test/contracts/src/ProxyForContractsDemo.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ interface IProxy{
) external payable;
}

// This contract adds Alith (0xf24....) as proxy to itself when it gets deployed.
// The purpose is to trigger a proxy creation BEFORE the contract code is stored.
// It bypasses the restriction of "no proxy for smart contract" but cannot be exploited
// because runtimes block the execution of a proxy if the proxied account contains code
// see https://github.com/moonbeam-foundation/moonbeam/pull/2533/files#diff-95857a497fb7c3739b385c704d94c0f41293c05703b539cb139093f78e0a4cfbR1122
contract ProxyForContractsDemo {

address immutable PROXY_ADDRESS = 0x000000000000000000000000000000000000080b;
Expand Down
4 changes: 2 additions & 2 deletions test/helpers/moonriver-tracing-samples.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@
{
"network": "moonriver",
"runtime": 1605,
"blockNumber": 2077599,
"txHash": "0x2cceda1436e32ae3b3a2194a8cb5bc4188259600c714789bae1fedc0bbc5125f"
"blockNumber": 2077600,
"txHash": "0x26d33099b7f8b1377c0c0cbadbfd3bc0318e21b039a48e520e3bbe1082238bd8"
},
{
"network": "moonriver",
Expand Down
12 changes: 12 additions & 0 deletions test/suites/dev/moonbase/test-proxy/test-proxy-for-contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ describeSuite({
contractAddress = deployedAddr;
});

// See ProxyForContractsDemo.sol for more explanation
it({
id: `T01`,
title: `Proxy Call to Smart Contract account should fail`,
Expand All @@ -37,5 +38,16 @@ describeSuite({
).rejects.toThrow("Invalid Transaction: Transaction call is not expected");
},
});

it({
id: `T02`,
title: `Adding a proxy to an existing contract should succeed`,
test: async function () {
const { result } = await context.createBlock(
context.polkadotJs().tx.proxy.addProxy(contractAddress, "Any", 0)
);
expect(result?.successful).to.be.true;
},
});
},
});
34 changes: 34 additions & 0 deletions typescript-api/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
metadata-*.json
build
# dist # Commented out to allow the dist directory to be included in the package
*.tgz

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Dependency directories
node_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

0 comments on commit d549395

Please sign in to comment.