Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat/test-codeql. test codeql #146

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ lib*.a

# Generated by Builders
**/artifacts/

api/libmovevm.so
api/libcompiler.so
15 changes: 14 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,18 @@ test-filenames:
echo $(COMPILER_SHARED_LIB_DST)
echo $(COMPILER_SHARED_LIB_SRC)

test: precompile test-rust test-go
test: check-libs precompile test-rust test-go

# TODO - codeql is failing without this symlink, not sure why
# - https://github.com/golang/go/issues/69605
check-libs:
@if [ ! -f api/$(SHARED_LIB_SRC) ]; then \
ln -s api/$(SHARED_LIB_DST) api/$(SHARED_LIB_SRC); \
fi

@if [ ! -f api/$(COMPILER_SHARED_LIB_SRC) ]; then \
ln -s api/$(COMPILER_SHARED_LIB_DST) api/$(COMPILER_SHARED_LIB_SRC); \
fi

test-go:
RUST_BACKTRACE=full go test -v -count=1 -parallel=1 ./...
Expand Down Expand Up @@ -129,7 +140,9 @@ clean:
@-rm libmovevm/bindings.h
@-rm libcompiler/bindings_compiler.h
@-rm api/$(SHARED_LIB_DST)
@-rm api/$(SHARED_LIB_SRC)
@-rm api/$(COMPILER_SHARED_LIB_DST)
@-rm api/$(COMPILER_SHARED_LIB_SRC)
@echo cleaned.

# Creates a release build in a containerized build environment of the static library for Alpine Linux (.a)
Expand Down
64 changes: 32 additions & 32 deletions tools/generate-bcs-go/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::{env::current_dir, fs::File};

use serde_generate::{golang::CodeGenerator, CodeGeneratorConfig, Encoding};
use serde_reflection::{Tracer, TracerConfig};
use serde_reflection::{Samples, Tracer, TracerConfig};

use initia_move_types::{
account::Account,
Expand All @@ -22,46 +22,46 @@ use initia_move_types::{
view_function::{ViewFunction, ViewOutput},
vm_config::InitiaVMConfig,
};
use move_core_types::{
account_address::AccountAddress,
identifier::Identifier,
language_storage::{ModuleId, ResourceKey, StructTag, TypeTag},
};
use move_core_types::language_storage::{ModuleId, ResourceKey, TypeTag};

fn main() {
let mut tracer = Tracer::new(TracerConfig::default());
tracer.trace_simple_type::<Identifier>().unwrap();
tracer.trace_simple_type::<AccountAddress>().unwrap();
tracer.trace_simple_type::<StructTag>().unwrap();
tracer.trace_simple_type::<TypeTag>().unwrap();
tracer.trace_simple_type::<ModuleId>().unwrap();
tracer.trace_simple_type::<ResourceKey>().unwrap();
tracer.trace_simple_type::<StakingDelta>().unwrap();
tracer.trace_simple_type::<CosmosMessage>().unwrap();
tracer.trace_simple_type::<Account>().unwrap();
tracer.trace_simple_type::<GasUsage>().unwrap();
tracer.trace_simple_type::<ExecutionResult>().unwrap();
tracer.trace_simple_type::<EntryFunction>().unwrap();
tracer.trace_simple_type::<ViewFunction>().unwrap();
tracer.trace_simple_type::<ViewOutput>().unwrap();
tracer.trace_simple_type::<ModuleBundle>().unwrap();
tracer.trace_simple_type::<Script>().unwrap();
tracer.trace_simple_type::<Env>().unwrap();
tracer.trace_simple_type::<TableInfo>().unwrap();
tracer.trace_simple_type::<InitiaVMConfig>().unwrap();
tracer.trace_simple_type::<CompilerArguments>().unwrap();
tracer.trace_simple_type::<CompilerBuildConfig>().unwrap();

// 1. Record samples for types with custom deserializers.
let samples = Samples::new();

// 2. Trace the main entry point(s) + every enum separately.
tracer.trace_type::<TypeTag>(&samples).unwrap();
tracer.trace_type::<ModuleId>(&samples).unwrap();
tracer.trace_type::<ResourceKey>(&samples).unwrap();
tracer.trace_type::<StakingDelta>(&samples).unwrap();
tracer.trace_type::<CosmosMessage>(&samples).unwrap();
tracer.trace_type::<Account>(&samples).unwrap();
tracer.trace_type::<GasUsage>(&samples).unwrap();
tracer.trace_type::<ExecutionResult>(&samples).unwrap();
tracer.trace_type::<EntryFunction>(&samples).unwrap();
tracer.trace_type::<ViewFunction>(&samples).unwrap();
tracer.trace_type::<ViewOutput>(&samples).unwrap();
tracer.trace_type::<ModuleBundle>(&samples).unwrap();
tracer.trace_type::<Script>(&samples).unwrap();
tracer.trace_type::<Env>(&samples).unwrap();
tracer.trace_type::<TableInfo>(&samples).unwrap();
tracer.trace_type::<InitiaVMConfig>(&samples).unwrap();
tracer.trace_type::<CompilerArguments>(&samples).unwrap();
tracer.trace_type::<CompilerBuildConfig>(&samples).unwrap();
tracer
.trace_type::<CompilerCoverageBytecodeOptions>(&samples)
.unwrap();
tracer
.trace_simple_type::<CompilerCoverageBytecodeOptions>()
.trace_type::<CompilerCoverageSourceOptions>(&samples)
.unwrap();
tracer
.trace_simple_type::<CompilerCoverageSourceOptions>()
.trace_type::<CompilerCoverageSummaryOptions>(&samples)
.unwrap();
tracer
.trace_simple_type::<CompilerCoverageSummaryOptions>()
.trace_type::<CompilerDocgenOptions>(&samples)
.unwrap();
tracer.trace_simple_type::<CompilerDocgenOptions>().unwrap();
tracer.trace_simple_type::<CompilerTestOptions>().unwrap();
tracer.trace_type::<CompilerTestOptions>(&samples).unwrap();

// aliases within StructTag
tracer
Expand Down
Loading