-
Notifications
You must be signed in to change notification settings - Fork 480
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into skip_test
- Loading branch information
Showing
81 changed files
with
2,953 additions
and
502 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,42 @@ | ||
name: Merge Checks | ||
|
||
on: | ||
pull_request: | ||
pull_request_target: | ||
branches: [ master ] | ||
types: [synchronize, opened, reopened, labeled, unlabeled] | ||
|
||
permissions: | ||
statuses: write | ||
|
||
jobs: | ||
design-approved-check: | ||
if: ${{ !contains(github.event.*.labels.*.name, 'design-approved') }} | ||
name: Design Approved Check | ||
check-design-approved: | ||
name: Check if Design Approved | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check for design-approved label | ||
- name: Check if design approved and update status | ||
run: | | ||
echo "Pull request is missing the 'design-approved' label" | ||
echo "This workflow fails so that the pull request cannot be merged" | ||
exit 1 | ||
set -x pipefail | ||
status_state="pending" | ||
if ${{ contains(github.event.*.labels.*.name, 'design-approved') }}; then | ||
status_state="success" | ||
else | ||
resp="$(curl -sSL --fail-with-body \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
"https://api.github.com/repos/$GITHUB_REPOSITORY/commits/${{ github.event.pull_request.head.sha }}/statuses")" | ||
if ! jq -e '.[] | select(.context == "Design Approved Check")' > /dev/null <<< "$resp"; then | ||
# Design not approved yet and no status exists | ||
# Keep it without a status to keep the green checkmark appearing | ||
# Otherwise, the commit and PR's CI will appear to be indefinitely pending | ||
# Merging will still be blocked until the required status appears | ||
exit 0 | ||
fi | ||
fi | ||
curl -sSL --fail-with-body \ | ||
-X POST \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
"https://api.github.com/repos/$GITHUB_REPOSITORY/statuses/${{ github.event.pull_request.head.sha }}" \ | ||
-d '{"context":"Design Approved Check","state":"'"$status_state"'"}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
;; Copyright 2024, Offchain Labs, Inc. | ||
;; For license information, see https://github.com/OffchainLabs/nitro/blob/master/LICENSE | ||
|
||
(module | ||
(import "vm_hooks" "pay_for_memory_grow" (func (param i32))) | ||
(import "vm_hooks" "read_args" (func $read_args (param i32))) | ||
(import "vm_hooks" "write_result" (func $write_result (param i32 i32))) | ||
(func (export "user_entrypoint") (param $args_len i32) (result i32) | ||
(local $size i32) | ||
|
||
;; read input | ||
i32.const 0 | ||
call $read_args | ||
|
||
;; read the target size from the last 4 bytes of the input big endian | ||
;; byte 1 | ||
local.get $args_len | ||
i32.const 1 | ||
i32.sub | ||
local.tee $size | ||
i32.load8_u | ||
|
||
;; byte 2 | ||
local.get $size | ||
i32.const 1 | ||
i32.sub | ||
local.tee $size | ||
i32.load8_u | ||
i32.const 8 | ||
i32.shl | ||
i32.or | ||
|
||
;; byte 3 | ||
local.get $size | ||
i32.const 1 | ||
i32.sub | ||
local.tee $size | ||
i32.load8_u | ||
i32.const 16 | ||
i32.shl | ||
i32.or | ||
|
||
;; byte 4 | ||
local.get $size | ||
i32.const 1 | ||
i32.sub | ||
local.tee $size | ||
i32.load8_u | ||
i32.const 32 | ||
i32.shl | ||
i32.or | ||
|
||
local.tee $size | ||
|
||
;; grow memory enough to handle the output | ||
;; we start with one page allocated, so no need to round up | ||
i32.const 65536 | ||
i32.div_u | ||
memory.grow | ||
drop | ||
|
||
;; set return data | ||
i32.const 0 | ||
local.get $size | ||
call $write_result | ||
|
||
;; return success | ||
i32.const 0 | ||
) | ||
(memory (export "memory") 1) | ||
) |
Oops, something went wrong.