Skip to content

Commit

Permalink
Merge branch 'master' into feature/shanghai-eip-4895-withdrawals
Browse files Browse the repository at this point in the history
  • Loading branch information
rubo committed Jan 6, 2023
2 parents 8e7be8d + e56ec5c commit dcb5a6a
Show file tree
Hide file tree
Showing 7 changed files with 124 additions and 128 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/release-nethermind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ jobs:
update-homebrew:
name: Update Homebrew formula
runs-on: ubuntu-latest
needs: approval
needs: [approval, build]
if: needs.build.outputs.PRERELEASE == 'false'
steps:
- name: Restore packages from cache
Expand Down Expand Up @@ -145,7 +145,7 @@ jobs:
publish-github:
name: Publish to GitHub
runs-on: ubuntu-latest
needs: approval
needs: [approval, build]
steps:
- name: Restore packages from cache
uses: actions/cache@v3
Expand All @@ -166,7 +166,7 @@ jobs:
publish-downloads:
name: Publish to Downloads page
runs-on: ubuntu-latest
needs: approval
needs: [approval, build]
if: needs.build.outputs.PRERELEASE == 'false'
steps:
- name: Restore packages from cache
Expand All @@ -191,7 +191,7 @@ jobs:
publish-dockers:
name: Publish to Docker Hub
runs-on: ubuntu-latest
needs: approval
needs: [approval, build]
env:
DOCKER_IMAGE: nethermind/nethermind
steps:
Expand Down Expand Up @@ -225,7 +225,7 @@ jobs:
publish-ppa:
name: Publish to PPA
runs-on: ubuntu-latest
needs: approval
needs: [approval, build]
if: needs.build.outputs.PRERELEASE == 'false'
env:
PPA_GPG_KEYID: ${{ secrets.PPA_GPG_KEYID }}
Expand Down
4 changes: 2 additions & 2 deletions scripts/deployment/publish-downloads.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ do

curl https://downloads.nethermind.io/files?apikey=$DOWNLOADS_PAGE \
-X POST \
--fail-with-body \
-# \
-F "files=@$PWD/$FILE_NAME" \
-F "files=@$PWD/$FILE_NAME.asc" \
--fail
-F "files=@$PWD/$FILE_NAME.asc"
done

echo "Publishing completed"
25 changes: 21 additions & 4 deletions scripts/deployment/publish-github.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,27 @@ BODY=$(printf \

echo "Drafting release $GIT_TAG"

RELEASE_ID=$(curl https://api.github.com/repos/$GITHUB_REPOSITORY/releases \
-X POST \
RELEASE_ID=$(curl https://api.github.com/repos/$GITHUB_REPOSITORY/releases/tags/$GIT_TAG \
-X GET \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-d "$BODY" | jq -r '.id')
-H "Authorization: Bearer $GITHUB_TOKEN" | jq -r '.id')

if [ "$RELEASE_ID" == "null" ]
then
RELEASE_ID=$(curl https://api.github.com/repos/$GITHUB_REPOSITORY/releases \
-X POST \
--fail-with-body \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-d "$BODY" | jq -r '.id')
else
curl https://api.github.com/repos/$GITHUB_REPOSITORY/releases/$RELEASE_ID \
-X PATCH \
--fail-with-body \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-d "$BODY"
fi

cd $PACKAGE_PATH

Expand All @@ -30,6 +46,7 @@ do

curl https://uploads.github.com/repos/$GITHUB_REPOSITORY/releases/$RELEASE_ID/assets?name=$FILE_NAME \
-X POST \
--fail-with-body \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "Content-Type: application/octet-stream" \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,8 @@ public static IEnumerable<TestCaseData> ConsecutiveInitiateChangeData
[TestCaseSource(nameof(ConsecutiveInitiateChangeData))]
public void consecutive_initiate_change_gets_finalized_and_switch_validators(ConsecutiveInitiateChangeTestParameters test)
{
Dictionary<int, int> hashSeeds = new();

Address[] currentValidators = GenerateValidators(1);
SetupInitialValidators(currentValidators);

Expand All @@ -490,20 +492,34 @@ public void consecutive_initiate_change_gets_finalized_and_switch_validators(Con
blockNumber = test.Current.BlockNumber + i;
}

if (hashSeeds.ContainsKey(blockNumber))
hashSeeds[blockNumber]++;
else
hashSeeds[blockNumber] = 0;

_block.Header.Number = blockNumber;
_block.Header.Beneficiary = currentValidators[blockNumber % currentValidators.Length];
_block.Header.AuRaStep = blockNumber;
_block.Header.Hash = Keccak.Compute(blockNumber.ToString());
_block.Header.Hash = Keccak.Compute((blockNumber + hashSeeds[blockNumber]).ToString());
_block.Header.ParentHash = blockNumber == test.StartBlockNumber ? Keccak.Zero : Keccak.Compute((blockNumber - 1 + hashSeeds[blockNumber - 1]).ToString());

TxReceipt[] txReceipts = test.GetReceipts(_validatorContract, _block, _contractAddress, _abiEncoder, SetupAbiAddresses);

Keccak? blockHashForClosure = _block.Hash;
_receiptsStorage.Get(Arg.Is<Block>(b => b.Hash == blockHashForClosure)).Returns(txReceipts);

_block.Header.Bloom = new Bloom(txReceipts.SelectMany(r => r.Logs).ToArray());

_blockTree.FindBlock(_block.Header.Hash, Arg.Any<BlockTreeLookupOptions>()).Returns(new Block(_block.Header.Clone(), BlockBody.Empty));

Action preProcess = () => validator.OnBlockProcessingStart(_block);
preProcess.Should().NotThrow<InvalidOperationException>(test.TestName);
validator.OnBlockProcessingEnd(_block, txReceipts);
int finalizedNumber = blockNumber - validator.Validators.MinSealersForFinalization() + 1;
_blockFinalizationManager.GetLastLevelFinalizedBy(_block.Header.Hash).Returns(finalizedNumber);
_blockFinalizationManager.BlocksFinalized += Raise.EventWith(
new FinalizeEventArgs(_block.Header, Build.A.BlockHeader.WithNumber(finalizedNumber)
.WithHash(Keccak.Compute(finalizedNumber.ToString())).TestObject));
.WithHash(Keccak.Compute((finalizedNumber + hashSeeds[finalizedNumber]).ToString())).TestObject));

currentValidators = test.GetCurrentValidators(blockNumber);
validator.Validators.Should().BeEquivalentTo(currentValidators, o => o.WithStrictOrdering(), $"Validator address should be recognized in block {blockNumber}");
Expand Down
Loading

0 comments on commit dcb5a6a

Please sign in to comment.