Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

Merge main into mardizzone/node-16 #490

Merged
merged 63 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from 56 commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
2e3d42c
new: support typed tx for erc20 burn predicate
Jul 26, 2021
4ecdedf
chg: ERC721 burn only predicate upgrade
Jul 27, 2021
59f545e
chg: use ExitPlayloadReader in WithdrawManager
Jul 27, 2021
b769ae9
chg: skip in flight test, we are not using it (it requires offsets)
Aug 2, 2021
d616537
chg: remove unused registry from ctor
Aug 2, 2021
a13ebf8
misc: avoid breaking flattener
Aug 2, 2021
de8200a
chg: use internal to avoid linking and external call
Aug 2, 2021
f8cb56e
chg: avoid using incoming in-flight exits (due to unused offsets)
Aug 2, 2021
ea7f311
fix: deployer for tests
Aug 2, 2021
bedc930
fix: do not use registry fora burn only erc20 predicate
Aug 3, 2021
e7505c9
fix: forbid implementation to initialize
Aug 18, 2021
64bb0cf
update npm module
zorancuc Aug 19, 2021
209dbeb
solve deployment issue
zorancuc Sep 1, 2021
be58c3c
update node version
zorancuc Sep 1, 2021
38f467a
remove bordevnet
zorancuc Sep 2, 2021
702b271
Merge pull request #375 from maticnetwork/0.3.0/deploy_issue
jdkanani Sep 7, 2021
5d02dc9
fix: set of checks
Sep 17, 2021
6884336
misc: remove .only
Sep 17, 2021
f8cb82c
chg: remove depositing on onERC721Received
Sep 17, 2021
2909b5a
fix: use OZ ERC721Holder
Sep 17, 2021
16198ff
some refactoring
Sep 17, 2021
71ccb30
Merge branch 'v0.3.0-backport' into typed-transactions
jdkanani Sep 17, 2021
aac51fb
Merge pull request #380 from maticnetwork/erc721-check
jdkanani Sep 17, 2021
a03c4dc
Merge branch 'v0.3.0-backport' into typed-transactions
imyourm8 Sep 17, 2021
17e3087
Merge pull request #366 from maticnetwork/typed-transactions
jdkanani Sep 17, 2021
9564ece
Add v0.3.0-backport for ci
jdkanani Sep 20, 2021
aa63354
Update ci.yml
jdkanani Sep 20, 2021
718bf86
Merge pull request #373 from maticnetwork/auto-init-implementation
jdkanani Sep 20, 2021
283b8d2
bump
Oct 7, 2021
c581ed6
fix
Oct 7, 2021
dcaa45a
Merge pull request #381 from maticnetwork/bump-dependecies
jdkanani Oct 7, 2021
83d9d66
new: log ShareTransfer in the shares contract
Nov 2, 2021
c836251
upd: emit validator id
Nov 2, 2021
461ee8b
Merge pull request #384 from maticnetwork/shares-transfer-event
imyourm8 Nov 8, 2021
55e8118
fix: remove transferWithSig in MRC20
imyourm8 Dec 8, 2021
7c0af26
Merge pull request #392 from maticnetwork/mrc-fix
jdkanani Dec 23, 2021
48f2288
fix: do not subtract delegation from timeline if validator is unstaked
Jan 17, 2022
fc58f80
new
Jan 17, 2022
2dd5fe5
chg
Jan 17, 2022
8c9ad51
stuff
Jan 20, 2022
746dfd6
chg
Jan 21, 2022
5dace23
Merge pull request #396 from maticnetwork/ddsb
jdkanani Jan 26, 2022
e9412e2
add test to check for correct reward distribution
gretzke Oct 21, 2022
4ecc0ed
fix: reward for unstaked validators
gretzke Oct 21, 2022
a90e879
ensure rewards can only be withdrawn once
gretzke Oct 21, 2022
0a2d68a
improve initialRewardPerStake consistency
gretzke Oct 27, 2022
51e17e0
test reward payout
gretzke Oct 27, 2022
1eb6960
test delegator reward getter consistency
gretzke Oct 31, 2022
913f4b1
fix: zero address check for malformed tx sig
DhairyaSethi Aug 16, 2023
ba520b6
Merge pull request #479 from maticnetwork/fix/invalid-sig
DhairyaSethi Sep 20, 2023
942e5c6
Merge remote-tracking branch 'origin' into leovct/node-16
leovct Nov 30, 2023
af53ace
chore: add `asdf` config file
leovct Nov 30, 2023
4b983b2
chore: bump node 16 version
leovct Nov 30, 2023
7ad0c25
ci: bump actions versions
leovct Nov 30, 2023
09d1676
chore: lint
leovct Nov 30, 2023
67f45dd
ci: enable to cancel in-progress jobs and add env
leovct Nov 30, 2023
7dc020e
chore: bump `bor` version in tests
leovct Nov 30, 2023
6ac7642
chore: update docker hub name
leovct Nov 30, 2023
c5cc058
chore: typo
leovct Nov 30, 2023
11d62d0
chore: nit
leovct Nov 30, 2023
00e918b
chore: debug
leovct Nov 30, 2023
008d50e
chore: debug bor-test
leovct Nov 30, 2023
80aa4e9
chore: update cmds to start bor
leovct Nov 30, 2023
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
17 changes: 11 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,25 @@ name: CI
on:
push:
branches:
- develop
- master
- release-0.3-3
- main
pull_request:

concurrency:
group: ci-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
NODE_VERSION: "16"

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Node.js environment
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '16'
node-version: ${{ env.NODE_VERSION }}
marcello33 marked this conversation as resolved.
Show resolved Hide resolved
registry-url: 'https://registry.npmjs.org'
- name: Cache npm dependencies
uses: actions/cache@v3
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.17.1
16.20.2
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodejs 16.20.2
72 changes: 72 additions & 0 deletions contracts/child/BaseERC20NoSig.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
pragma solidity ^0.5.2;

import "./ChildToken.sol";

contract BaseERC20NoSig is ChildToken {
event Deposit(
address indexed token,
address indexed from,
uint256 amount,
uint256 input1,
uint256 output1
);

event Withdraw(
address indexed token,
address indexed from,
uint256 amount,
uint256 input1,
uint256 output1
);

event LogTransfer(
address indexed token,
address indexed from,
address indexed to,
uint256 amount,
uint256 input1,
uint256 input2,
uint256 output1,
uint256 output2
);

constructor() public {}

function transferWithSig(
bytes calldata sig,
uint256 amount,
bytes32 data,
uint256 expiration,
address to
) external returns (address from) {
revert("Disabled feature");
}

function balanceOf(address account) external view returns (uint256);
function _transfer(address sender, address recipient, uint256 amount)
internal;

/// @param from Address from where tokens are withdrawn.
/// @param to Address to where tokens are sent.
/// @param value Number of tokens to transfer.
/// @return Returns success of function call.
function _transferFrom(address from, address to, uint256 value)
internal
returns (bool)
{
uint256 input1 = this.balanceOf(from);
uint256 input2 = this.balanceOf(to);
_transfer(from, to, value);
emit LogTransfer(
token,
from,
to,
value,
input1,
input2,
this.balanceOf(from),
this.balanceOf(to)
);
return true;
}
}
4 changes: 1 addition & 3 deletions contracts/child/ChildERC721.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
pragma solidity ^0.5.2;

import {
ERC721Full
} from "openzeppelin-solidity/contracts/token/ERC721/ERC721Full.sol";
import {ERC721Full} from "openzeppelin-solidity/contracts/token/ERC721/ERC721Full.sol";

import "./ChildToken.sol";
import "./misc/IParentToken.sol";
Expand Down
4 changes: 2 additions & 2 deletions contracts/child/MRC20.sol
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
pragma solidity ^0.5.11;

import "./BaseERC20.sol";
import "./BaseERC20NoSig.sol";

/**
* @title Matic token contract
* @notice This contract is an ECR20 like wrapper over native ether (matic token) transfers on the matic chain
* @dev ERC20 methods have been made payable while keeping their method signature same as other ChildERC20s on Matic
*/
contract MRC20 is BaseERC20 {
contract MRC20 is BaseERC20NoSig {
event Transfer(address indexed from, address indexed to, uint256 value);

uint256 public currentSupply = 0;
Expand Down
170 changes: 170 additions & 0 deletions contracts/common/lib/ExitPayloadReader.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
pragma solidity 0.5.17;

import {RLPReader} from "solidity-rlp/contracts/RLPReader.sol";
import {BytesLib} from "./BytesLib.sol";

library ExitPayloadReader {
using RLPReader for bytes;
using RLPReader for RLPReader.RLPItem;

uint8 constant WORD_SIZE = 32;

struct ExitPayload {
RLPReader.RLPItem[] data;
}

struct Receipt {
RLPReader.RLPItem[] data;
bytes raw;
uint256 logIndex;
}

struct Log {
RLPReader.RLPItem data;
RLPReader.RLPItem[] list;
}

struct LogTopics {
RLPReader.RLPItem[] data;
}

function toExitPayload(bytes memory data)
internal
pure
returns (ExitPayload memory)
{
RLPReader.RLPItem[] memory payloadData = data
.toRlpItem()
.toList();

return ExitPayload(payloadData);
}

function copy(uint src, uint dest, uint len) private pure {
if (len == 0) return;

// copy as many word sizes as possible
for (; len >= WORD_SIZE; len -= WORD_SIZE) {
assembly {
mstore(dest, mload(src))
}

src += WORD_SIZE;
dest += WORD_SIZE;
}

// left over bytes. Mask is used to remove unwanted bytes from the word
uint mask = 256 ** (WORD_SIZE - len) - 1;
assembly {
let srcpart := and(mload(src), not(mask)) // zero out src
let destpart := and(mload(dest), mask) // retrieve the bytes
mstore(dest, or(destpart, srcpart))
}
}

function getHeaderNumber(ExitPayload memory payload) internal pure returns(uint256) {
return payload.data[0].toUint();
}

function getBlockProof(ExitPayload memory payload) internal pure returns(bytes memory) {
return payload.data[1].toBytes();
}

function getBlockNumber(ExitPayload memory payload) internal pure returns(uint256) {
return payload.data[2].toUint();
}

function getBlockTime(ExitPayload memory payload) internal pure returns(uint256) {
return payload.data[3].toUint();
}

function getTxRoot(ExitPayload memory payload) internal pure returns(bytes32) {
return bytes32(payload.data[4].toUint());
}

function getReceiptRoot(ExitPayload memory payload) internal pure returns(bytes32) {
return bytes32(payload.data[5].toUint());
}

function getReceipt(ExitPayload memory payload) internal pure returns(Receipt memory receipt) {
receipt.raw = payload.data[6].toBytes();
RLPReader.RLPItem memory receiptItem = receipt.raw.toRlpItem();

if (receiptItem.isList()) {
// legacy tx
receipt.data = receiptItem.toList();
} else {
// pop first byte before parsting receipt
bytes memory typedBytes = receipt.raw;
bytes memory result = new bytes(typedBytes.length - 1);
uint256 srcPtr;
uint256 destPtr;
assembly {
srcPtr := add(33, typedBytes)
destPtr := add(0x20, result)
}

copy(srcPtr, destPtr, result.length);
receipt.data = result.toRlpItem().toList();
}

receipt.logIndex = getReceiptLogIndex(payload);
return receipt;
}

function getReceiptProof(ExitPayload memory payload) internal pure returns(bytes memory) {
return payload.data[7].toBytes();
}

function getBranchMaskAsBytes(ExitPayload memory payload) internal pure returns(bytes memory) {
return payload.data[8].toBytes();
}

function getBranchMaskAsUint(ExitPayload memory payload) internal pure returns(uint256) {
return payload.data[8].toUint();
}

function getReceiptLogIndex(ExitPayload memory payload) internal pure returns(uint256) {
return payload.data[9].toUint();
}

function getTx(ExitPayload memory payload) internal pure returns(bytes memory) {
return payload.data[10].toBytes();
}

function getTxProof(ExitPayload memory payload) internal pure returns(bytes memory) {
return payload.data[11].toBytes();
}

// Receipt methods
function toBytes(Receipt memory receipt) internal pure returns(bytes memory) {
return receipt.raw;
}

function getLog(Receipt memory receipt) internal pure returns(Log memory) {
RLPReader.RLPItem memory logData = receipt.data[3].toList()[receipt.logIndex];
return Log(logData, logData.toList());
}

// Log methods
function getEmitter(Log memory log) internal pure returns(address) {
return RLPReader.toAddress(log.list[0]);
}

function getTopics(Log memory log) internal pure returns(LogTopics memory) {
return LogTopics(log.list[1].toList());
}

function getData(Log memory log) internal pure returns(bytes memory) {
return log.list[2].toBytes();
}

function toRlpBytes(Log memory log) internal pure returns(bytes memory) {
return log.data.toRlpBytes();
}

// LogTopics methods
function getField(LogTopics memory topics, uint256 index) internal pure returns(RLPReader.RLPItem memory) {
return topics.data[index];
}
}
2 changes: 1 addition & 1 deletion contracts/common/lib/Merkle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ library Merkle {
uint256 index,
bytes32 rootHash,
bytes memory proof
) public pure returns (bool) {
) internal pure returns (bool) {
require(proof.length % 32 == 0, "Invalid proof length");
uint256 proofHeight = proof.length / 32;
// Proof of size n means, height of the tree is n+1.
Expand Down
12 changes: 3 additions & 9 deletions contracts/common/tokens/ERC721PlasmaMintable.sol
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
pragma solidity ^0.5.2;

import {
ERC721Mintable
} from "openzeppelin-solidity/contracts/token/ERC721/ERC721Mintable.sol";
import {
ERC721MetadataMintable
} from "openzeppelin-solidity/contracts/token/ERC721/ERC721MetadataMintable.sol";
import {
ERC721Metadata
} from "openzeppelin-solidity/contracts/token/ERC721/ERC721Metadata.sol";
import {ERC721Mintable} from "openzeppelin-solidity/contracts/token/ERC721/ERC721Mintable.sol";
import {ERC721MetadataMintable} from "openzeppelin-solidity/contracts/token/ERC721/ERC721MetadataMintable.sol";
import {ERC721Metadata} from "openzeppelin-solidity/contracts/token/ERC721/ERC721Metadata.sol";

contract ERC721PlasmaMintable is ERC721Mintable, ERC721MetadataMintable {
constructor(string memory name, string memory symbol)
Expand Down
4 changes: 1 addition & 3 deletions contracts/common/tokens/RootERC721.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
pragma solidity ^0.5.2;

import {
ERC721Full
} from "openzeppelin-solidity/contracts/token/ERC721/ERC721Full.sol";
import {ERC721Full} from "openzeppelin-solidity/contracts/token/ERC721/ERC721Full.sol";

contract RootERC721 is ERC721Full {
constructor(string memory name, string memory symbol)
Expand Down
Loading
Loading