From 06035e6e66038bf2bbf8d67db7e1e6159d9ff6f1 Mon Sep 17 00:00:00 2001 From: Alan Sapede Date: Wed, 13 Nov 2024 05:38:49 -0300 Subject: [PATCH 1/3] Adds more documentation for contract proxying tests (#3042) * Adds more documentation for contract proxying --- test/contracts/src/ProxyForContractsDemo.sol | 5 +++++ .../moonbase/test-proxy/test-proxy-for-contracts.ts | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/test/contracts/src/ProxyForContractsDemo.sol b/test/contracts/src/ProxyForContractsDemo.sol index 49fa44884b..ee72cdd316 100644 --- a/test/contracts/src/ProxyForContractsDemo.sol +++ b/test/contracts/src/ProxyForContractsDemo.sol @@ -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; diff --git a/test/suites/dev/moonbase/test-proxy/test-proxy-for-contracts.ts b/test/suites/dev/moonbase/test-proxy/test-proxy-for-contracts.ts index 3027b0dfde..13a8184fd7 100644 --- a/test/suites/dev/moonbase/test-proxy/test-proxy-for-contracts.ts +++ b/test/suites/dev/moonbase/test-proxy/test-proxy-for-contracts.ts @@ -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`, @@ -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; + }, + }); }, }); From 0372691bbee7a6573907488d6a3e0f9ac5204d06 Mon Sep 17 00:00:00 2001 From: Alan Sapede Date: Wed, 13 Nov 2024 05:39:13 -0300 Subject: [PATCH 2/3] Allow dist of api-augment to be in the npm package (#3037) --- typescript-api/.npmignore | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 typescript-api/.npmignore diff --git a/typescript-api/.npmignore b/typescript-api/.npmignore new file mode 100644 index 0000000000..243e950690 --- /dev/null +++ b/typescript-api/.npmignore @@ -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 From d184125a33c69fabc7871273a836f791b3ccefcf Mon Sep 17 00:00:00 2001 From: Rodrigo Quelhas <22591718+RomarQ@users.noreply.github.com> Date: Wed, 13 Nov 2024 13:43:31 +0000 Subject: [PATCH 3/3] fix(smoke): use valid moonriver transaction for runtime 1605 (#3044) --- test/helpers/moonriver-tracing-samples.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/helpers/moonriver-tracing-samples.json b/test/helpers/moonriver-tracing-samples.json index 67a4ff560a..21d116cdf6 100644 --- a/test/helpers/moonriver-tracing-samples.json +++ b/test/helpers/moonriver-tracing-samples.json @@ -104,8 +104,8 @@ { "network": "moonriver", "runtime": 1605, - "blockNumber": 2077599, - "txHash": "0x2cceda1436e32ae3b3a2194a8cb5bc4188259600c714789bae1fedc0bbc5125f" + "blockNumber": 2077600, + "txHash": "0x26d33099b7f8b1377c0c0cbadbfd3bc0318e21b039a48e520e3bbe1082238bd8" }, { "network": "moonriver",