Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
c0146f0
Supporting PolkaVM for Hardhat Upgrades
KitHat Sep 11, 2025
d85687f
update versions
KitHat Sep 12, 2025
cd42806
test fixes
KitHat Sep 15, 2025
24ee9de
hardening
KitHat Sep 17, 2025
2613ec6
hardening vol 2
KitHat Sep 17, 2025
c913c2c
push node version
KitHat Sep 17, 2025
bd9e3cc
fix lint, remove unused dependencies
KitHat Sep 18, 2025
45f6c3c
get back minimatch
KitHat Sep 18, 2025
26b2e6c
lockfile
KitHat Sep 18, 2025
d25bdb6
changeset
KitHat Sep 18, 2025
83eeb90
changeset try 2
KitHat Sep 18, 2025
d32934a
bump node version
KitHat Sep 22, 2025
263a2d4
add recursive module checkout
KitHat Sep 24, 2025
b97b793
test submodule add
KitHat Sep 24, 2025
acd8255
get submodule back
KitHat Sep 24, 2025
1e034cb
push to the new version of hardhat-polkadot, update configs and checks
KitHat Oct 9, 2025
dc38b50
fix lint
KitHat Oct 9, 2025
ff41243
additional polkadot checks
KitHat Oct 9, 2025
a7c333f
lint fix
KitHat Oct 9, 2025
453cfb7
Update packages/plugin-hardhat/src/defender/deploy.ts
KitHat Oct 22, 2025
7fb71dd
add happy path tests to the plugin CI
KitHat Oct 28, 2025
9d371b4
fix linter
KitHat Oct 28, 2025
9aad8a2
fix sed invocation
KitHat Oct 28, 2025
5dceea4
fix regex, skip selfdestruct
KitHat Oct 28, 2025
229119c
fix linter
KitHat Oct 28, 2025
c312c9c
separate PVM test run from EVM
KitHat Oct 28, 2025
2698f9b
fix contracts, add more tests, add backup
KitHat Oct 30, 2025
3817677
fix Invalid, clean up contracts
KitHat Oct 30, 2025
13237e7
return ignores
KitHat Oct 30, 2025
d53bdca
fix rejection check
KitHat Oct 30, 2025
a89a0b9
add chai matchers
KitHat Oct 30, 2025
e9629da
better validation
KitHat Oct 30, 2025
1cea266
easen the restrictions
KitHat Oct 30, 2025
595c469
fix linting
KitHat Oct 30, 2025
e70899d
bumped polkadot plugin version, updated the test
KitHat Oct 31, 2025
d26bd2b
contract update
KitHat Oct 31, 2025
44f2ecc
Fix validation testcase, add storage gap test
ericglau Oct 31, 2025
114af70
Simplify regex
ericglau Oct 31, 2025
6bdf2f8
Test storage insert between slots
ericglau Oct 31, 2025
b901526
Add test to pvm
ericglau Oct 31, 2025
804290a
Insert variable after gap for testing
ericglau Oct 31, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/ninety-rocks-flow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@openzeppelin/hardhat-upgrades': minor
'@openzeppelin/upgrades-core': minor
---

Supported hardhat-polkadot plugin for upgrades on Polkadot AssetHub
6 changes: 6 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,11 @@ module.exports = {
it: 'readonly',
},
},
{
files: ['packages/plugin-hardhat/test-pvm/**'],
env: {
mocha: true,
},
},
],
};
2 changes: 1 addition & 1 deletion .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ runs:
steps:
- uses: actions/setup-node@v4
with:
node-version: 20.x
node-version: 22.x
cache: yarn

- name: Install dependencies
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ jobs:

- name: Run tests
run: yarn --cwd "packages/${{matrix.package}}" run test
# This is temporary, later it would be integrated into the main run
- name: Run PVM tests
if: matrix.package == 'plugin-hardhat'
run: yarn --cwd "packages/${{matrix.package}}" run test:pvm

coverage:
runs-on: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ coverage
.env
/examples
package-lock.json
artifacts-pvm
cache-pvm
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20
22
71 changes: 0 additions & 71 deletions packages/core/contracts/test/ValidationsNatspec.sol
Original file line number Diff line number Diff line change
Expand Up @@ -63,26 +63,6 @@ contract HasImmutableStateVariableNatspec3 {
uint immutable y = 2;
}

/// @custom:oz-upgrades-unsafe-allow selfdestruct
contract HasSelfDestructNatspec1 {
function d() public {
selfdestruct(payable(msg.sender));
}
}

contract HasSelfDestructNatspec2 {
/// @custom:oz-upgrades-unsafe-allow selfdestruct
function d() public {
selfdestruct(payable(msg.sender));
}
}

contract HasSelfDestructNatspec3 {
function d() public {
/// @custom:oz-upgrades-unsafe-allow selfdestruct
selfdestruct(payable(msg.sender));
}
}

/// @custom:oz-upgrades-unsafe-allow delegatecall
contract HasDelegateCallNatspec1 {
Expand Down Expand Up @@ -132,22 +112,6 @@ library SafeExternalLibraryNatspec {
}
}

library UnsafeInternalLibraryNatspec {
function explode(uint x, uint y) internal {
x + y;
/// @custom:oz-upgrades-unsafe-allow selfdestruct
selfdestruct(payable(msg.sender));
}
}

library UnsafeExternalLibraryNatspec {
function explode(uint x, uint y) public {
x + y;
/// @custom:oz-upgrades-unsafe-allow selfdestruct
selfdestruct(payable(msg.sender));
}
}

// usage

contract UsesImplicitSafeInternalLibraryNatspec {
Expand All @@ -169,25 +133,6 @@ contract UsesImplicitSafeExternalLibraryNatspec {
}
}

contract UsesImplicitUnsafeInternalLibraryNatspec {
using UnsafeInternalLibraryNatspec for uint;
uint x;

function foo(uint y) public {
x.explode(y);
}
}

/// @custom:oz-upgrades-unsafe-allow external-library-linking
contract UsesImplicitUnsafeExternalLibraryNatspec {
using UnsafeExternalLibraryNatspec for uint;
uint x;

function foo(uint y) public {
x.explode(y);
}
}

contract UsesExplicitSafeInternalLibraryNatspec {
uint x;

Expand All @@ -205,19 +150,3 @@ contract UsesExplicitSafeExternalLibraryNatspec {
}
}

contract UsesExplicitUnsafeInternalLibraryNatspec {
uint x;

function foo(uint y) public {
UnsafeInternalLibraryNatspec.explode(x, y);
}
}

/// @custom:oz-upgrades-unsafe-allow external-library-linking
contract UsesExplicitUnsafeExternalLibraryNatspec {
uint x;

function foo(uint y) public {
UnsafeExternalLibraryNatspec.explode(x, y);
}
}
75 changes: 75 additions & 0 deletions packages/core/contracts/test/ValidationsNatspecSelfdestruct.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;

/// @custom:oz-upgrades-unsafe-allow selfdestruct
contract HasSelfDestructNatspec1 {
function d() public {
selfdestruct(payable(msg.sender));
}
}

contract HasSelfDestructNatspec2 {
/// @custom:oz-upgrades-unsafe-allow selfdestruct
function d() public {
selfdestruct(payable(msg.sender));
}
}

contract HasSelfDestructNatspec3 {
function d() public {
/// @custom:oz-upgrades-unsafe-allow selfdestruct
selfdestruct(payable(msg.sender));
}
}

library UnsafeInternalLibraryNatspec {
function explode(uint x, uint y) internal {
x + y;
/// @custom:oz-upgrades-unsafe-allow selfdestruct
selfdestruct(payable(msg.sender));
}
}

library UnsafeExternalLibraryNatspec {
function explode(uint x, uint y) public {
x + y;
/// @custom:oz-upgrades-unsafe-allow selfdestruct
selfdestruct(payable(msg.sender));
}
}

contract UsesImplicitUnsafeInternalLibraryNatspec {
using UnsafeInternalLibraryNatspec for uint;
uint x;

function foo(uint y) public {
x.explode(y);
}
}

/// @custom:oz-upgrades-unsafe-allow external-library-linking
contract UsesImplicitUnsafeExternalLibraryNatspec {
using UnsafeExternalLibraryNatspec for uint;
uint x;

function foo(uint y) public {
x.explode(y);
}
}

contract UsesExplicitUnsafeInternalLibraryNatspec {
uint x;

function foo(uint y) public {
UnsafeInternalLibraryNatspec.explode(x, y);
}
}

/// @custom:oz-upgrades-unsafe-allow external-library-linking
contract UsesExplicitUnsafeExternalLibraryNatspec {
uint x;

function foo(uint y) public {
UnsafeExternalLibraryNatspec.explode(x, y);
}
}
85 changes: 0 additions & 85 deletions packages/core/contracts/test/cli/Validate.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@ contract Safe {
}
}

contract NonUpgradeable {
function sd() public {
selfdestruct(payable(msg.sender));
}
}

abstract contract Initializable {
function initialize() virtual public;
}
Expand All @@ -36,36 +30,6 @@ contract HasUpgradeToConstructorUnsafe {
}
}

/**
* @custom:oz-upgrades
*/
contract MultipleUnsafe {
function sd() public {
selfdestruct(payable(msg.sender));
}

/// @custom:oz-upgrades-unsafe-allow selfdestruct
function sd2() public {
selfdestruct(payable(msg.sender));
}

function dc() public {
(bool s, ) = msg.sender.delegatecall("");
s;
}

function dc2() public {
(bool s, ) = msg.sender.delegatecall("");
s;
}
}

/**
* @custom:oz-upgrades
*/
contract InheritsMultipleUnsafe is MultipleUnsafe {
}

/**
* @custom:oz-upgrades-from HasUpgradeTo
*/
Expand All @@ -85,62 +49,13 @@ contract StorageV1 {
uint256[49] private __gap;
}

/**
* @custom:oz-upgrades-from StorageV1
*/
contract UnsafeAndStorageLayoutErrors {
uint256 public x;
uint256 public y;
uint256[49] private __gap;

function sd() public {
selfdestruct(payable(msg.sender));
}
}

/**
* @custom:oz-upgrades-from MultipleUnsafe
*/
contract BecomesSafe {
bool public x;
}

/**
* @custom:oz-upgrades-from BecomesSafe
*/
contract BecomesBadLayout {
}

/**
* @custom:oz-upgrades-from NonUpgradeable
*/
contract StillUnsafe {
function sd() public {
selfdestruct(payable(msg.sender));
}
}

abstract contract AbstractUpgradeable is Initializable {
}

contract InheritsAbstractUpgradeable is AbstractUpgradeable {
function initialize() public virtual override {}
}

/**
* @custom:oz-upgrades
* @custom:oz-upgrades-from StorageV1
*/
contract BothAnnotationsUnsafe {
uint256 public x;
uint256 public y;
uint256[49] private __gap;

function sd() public {
selfdestruct(payable(msg.sender));
}
}

contract StorageV2_Bad_NoAnnotation {
uint256 public x;
uint256 public y;
Expand Down
Loading
Loading