Skip to content

Commit

Permalink
merge master and resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
ganeshvanahalli committed Sep 5, 2024
2 parents ecd2722 + 5828659 commit 4028e99
Show file tree
Hide file tree
Showing 43 changed files with 1,062 additions and 473 deletions.
37 changes: 32 additions & 5 deletions .github/workflows/submodule-pin-check.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,48 @@
name: Submodule Pin Check
name: Merge Checks

on:
pull_request:
pull_request_target:
branches: [ master ]
types: [synchronize, opened, reopened]

permissions:
statuses: write

jobs:
submodule-pin-check:
name: Submodule Pin Check
name: Check Submodule Pin
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
submodules: true

- name: Check all submodules are ancestors of origin/HEAD or configured branch
run: ${{ github.workspace }}/.github/workflows/submodule-pin-check.sh
run: |
status_state="pending"
if ${{ github.workspace }}/.github/workflows/submodule-pin-check.sh; 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 == "Submodule Pin Check")' > /dev/null <<< "$resp"; then
# Submodule pin check is failling 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":"Submodule Pin Check","state":"'"$status_state"'"}'
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ ifneq ($(origin GOLANG_LDFLAGS),undefined)
GOLANG_PARAMS = -ldflags="-extldflags '-ldl' $(GOLANG_LDFLAGS)"
endif

UNAME_S := $(shell uname -s)

# In Mac OSX, there are a lot of warnings emitted if these environment variables aren't set.
ifeq ($(UNAME_S), Darwin)
export MACOSX_DEPLOYMENT_TARGET := $(shell sw_vers -productVersion)
export CGO_LDFLAGS := -Wl,-no_warn_duplicate_libraries
endif

precompile_names = AddressTable Aggregator BLS Debug FunctionTable GasInfo Info osTest Owner RetryableTx Statistics Sys
precompiles = $(patsubst %,./solgen/generated/%.go, $(precompile_names))

Expand Down
19 changes: 14 additions & 5 deletions arbitrator/arbutil/src/evm/req.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use crate::{
storage::{StorageCache, StorageWord},
user::UserOutcomeKind,
},
format::Utf8OrHex,
pricing::EVM_API_INK,
Bytes20, Bytes32,
};
Expand Down Expand Up @@ -140,8 +139,13 @@ impl<D: DataReader, H: RequestHandler<D>> EvmApi<D> for EvmApiRequestor<D, H> {
}

let (res, _, cost) = self.request(EvmApiMethod::SetTrieSlots, data);
if res[0] != EvmApiStatus::Success.into() {
bail!("{}", String::from_utf8_or_hex(res));
let status = res
.first()
.copied()
.map(EvmApiStatus::from)
.unwrap_or(EvmApiStatus::Failure);
if status != EvmApiStatus::Success {
bail!("{:?}", status);
}
Ok(cost)
}
Expand All @@ -156,8 +160,13 @@ impl<D: DataReader, H: RequestHandler<D>> EvmApi<D> for EvmApiRequestor<D, H> {
data.extend(key);
data.extend(value);
let (res, ..) = self.request(EvmApiMethod::SetTransientBytes32, data);
if res[0] != EvmApiStatus::Success.into() {
bail!("{}", String::from_utf8_or_hex(res));
let status = res
.first()
.copied()
.map(EvmApiStatus::from)
.unwrap_or(EvmApiStatus::Failure);
if status != EvmApiStatus::Success {
bail!("{:?}", status);
}
Ok(())
}
Expand Down
89 changes: 69 additions & 20 deletions arbitrator/stylus/src/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ use arbutil::{
};
use caller_env::GuestPtr;
use eyre::Result;
use prover::value::Value;
use std::{
fmt::Display,
mem::{self, MaybeUninit},
Expand Down Expand Up @@ -441,26 +440,76 @@ pub(crate) fn pay_for_memory_grow<D: DataReader, E: EvmApi<D>>(
hostio!(env, pay_for_memory_grow(pages))
}

pub(crate) fn console_log_text<D: DataReader, E: EvmApi<D>>(
mut env: WasmEnvMut<D, E>,
ptr: GuestPtr,
len: u32,
) -> MaybeEscape {
hostio!(env, console_log_text(ptr, len))
}
pub(crate) mod console {
use super::*;

pub(crate) fn console_log<D: DataReader, E: EvmApi<D>, T: Into<Value>>(
mut env: WasmEnvMut<D, E>,
value: T,
) -> MaybeEscape {
hostio!(env, console_log(value))
}
pub(crate) fn log_txt<D: DataReader, E: EvmApi<D>>(
mut env: WasmEnvMut<D, E>,
ptr: GuestPtr,
len: u32,
) -> MaybeEscape {
hostio!(env, console_log_text(ptr, len))
}

pub(crate) fn console_tee<D: DataReader, E: EvmApi<D>, T: Into<Value> + Copy>(
mut env: WasmEnvMut<D, E>,
value: T,
) -> Result<T, Escape> {
hostio!(env, console_tee(value))
pub(crate) fn log_i32<D: DataReader, E: EvmApi<D>>(
mut env: WasmEnvMut<D, E>,
value: u32,
) -> MaybeEscape {
hostio!(env, console_log(value))
}

pub(crate) fn tee_i32<D: DataReader, E: EvmApi<D>>(
mut env: WasmEnvMut<D, E>,
value: u32,
) -> Result<u32, Escape> {
hostio!(env, console_tee(value))
}

pub(crate) fn log_i64<D: DataReader, E: EvmApi<D>>(
mut env: WasmEnvMut<D, E>,
value: u64,
) -> MaybeEscape {
hostio!(env, console_log(value))
}

pub(crate) fn tee_i64<D: DataReader, E: EvmApi<D>>(
mut env: WasmEnvMut<D, E>,
value: u64,
) -> Result<u64, Escape> {
hostio!(env, console_tee(value))
}

pub(crate) fn log_f32<D: DataReader, E: EvmApi<D>>(
mut env: WasmEnvMut<D, E>,
value: f32,
) -> MaybeEscape {
hostio!(env, console_log(value))
}

pub(crate) fn tee_f32<D: DataReader, E: EvmApi<D>>(
mut env: WasmEnvMut<D, E>,
value: f32,
) -> Result<f32, Escape> {
hostio!(env, console_tee(value))
}

pub(crate) fn log_f64<D: DataReader, E: EvmApi<D>>(
mut env: WasmEnvMut<D, E>,
value: f64,
) -> MaybeEscape {
hostio!(env, console_log(value))
}

pub(crate) fn tee_f64<D: DataReader, E: EvmApi<D>>(
mut env: WasmEnvMut<D, E>,
value: f64,
) -> Result<f64, Escape> {
hostio!(env, console_tee(value))
}
}

pub(crate) fn null_host<D: DataReader, E: EvmApi<D>>(_: WasmEnvMut<D, E>) {}
pub(crate) mod debug {
use super::*;

pub(crate) fn null_host<D: DataReader, E: EvmApi<D>>(_: WasmEnvMut<D, E>) {}
}
Loading

0 comments on commit 4028e99

Please sign in to comment.