forked from aergoio/aergo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request aergoio#369 from aergoio/develop
Merge for release v2.6.0
- Loading branch information
Showing
111 changed files
with
9,824 additions
and
2,117 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
FROM golang:1.19.0-bullseye as builder | ||
RUN apt-get -y update && apt-get -y install build-essential git cmake binutils m4 file | ||
COPY . aergo | ||
RUN cd aergo && make aergosvr polaris colaris aergocli aergoluac brick |
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,92 @@ | ||
#!/usr/bin/env bash | ||
|
||
# This script can be used to build the Docker images manually (outside of CI) | ||
|
||
set -e | ||
|
||
MAIN_TAG=$1 | ||
SECOND_TAG=$2 | ||
THIRD_TAG=$3 | ||
|
||
if [[ -z "$MAIN_TAG" ]] | ||
then | ||
echo "Usage:" | ||
echo " build-local.sh tag [second-tag] [third-tag]" | ||
echo "Example:" | ||
echo " build-local.sh 0.12.0-rc" | ||
echo " build-local.sh 0.12.0 0.12 latest" | ||
exit 1 | ||
fi | ||
|
||
|
||
echo "Preparing local folder for build" | ||
|
||
cd .. | ||
git submodule update --init --recursive | ||
make clean || true | ||
rm -rf build | ||
go clean --cache | ||
|
||
|
||
if [[ -z "$THIRD_TAG" ]] | ||
then | ||
if [[ -z "$SECOND_TAG" ]] | ||
then | ||
declare -a tags=("$MAIN_TAG") | ||
else | ||
declare -a tags=("$MAIN_TAG" "$SECOND_TAG") | ||
fi | ||
else | ||
declare -a tags=("$MAIN_TAG" "$SECOND_TAG" "$THIRD_TAG") | ||
fi | ||
|
||
echo "Building Docker images for ${tags[*]} using local folder" | ||
sleep 1 | ||
|
||
BUILDER_TAG="aergo/local-builder" | ||
echo "Building ${BUILDER_TAG}" | ||
|
||
docker build --no-cache --file Docker/Dockerfile.local -t ${BUILDER_TAG} . | ||
cd - | ||
docker create --name extract ${BUILDER_TAG} | ||
docker cp extract:/go/aergo/bin/ . | ||
docker cp extract:/go/aergo/cmd/brick/arglog.toml bin/brick-arglog.toml | ||
docker cp extract:/go/aergo/libtool/lib/ . | ||
docker rm -f extract | ||
|
||
declare -a names=("node" "tools" "polaris") | ||
for name in "${names[@]}" | ||
do | ||
tagsExpanded=() | ||
for tag in "${tags[@]}"; do | ||
tagsExpanded+=("-t aergo/$name:$tag") | ||
done | ||
echo "[aergo/$name:${tags[*]}]" | ||
DOCKERFILE="Dockerfile.$name" | ||
echo docker build -q ${tagsExpanded[@]} --file $DOCKERFILE . | ||
imageid=`docker build -q ${tagsExpanded[@]} --file $DOCKERFILE .` | ||
docker images --format "Done: \t{{.Repository}}:{{.Tag}} \t{{.ID}} ({{.Size}})" | grep "${imageid:7:12}" | ||
done | ||
|
||
rm -rf bin lib | ||
|
||
echo -e "\nREPOSITORY TAG IMAGE ID CREATED SIZE" | ||
for name in "${names[@]}" | ||
do | ||
for tag in "${tags[@]}" | ||
do | ||
docker images aergo/$name:$tag | tail -1 | ||
done | ||
done | ||
|
||
echo -e "\nYou can now push these to Docker Hub." | ||
echo "For example:" | ||
|
||
declare -a names=("node" "tools" "polaris") | ||
for name in "${names[@]}" | ||
do | ||
for tag in "${tags[@]}" | ||
do | ||
echo " docker push aergo/$name:$tag" | ||
done | ||
done |
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,59 @@ | ||
package blacklist | ||
|
||
import ( | ||
"github.com/aergoio/aergo/v2/types" | ||
"github.com/aergoio/aergo/v2/internal/common" | ||
"github.com/aergoio/aergo/v2/internal/enc/hex" | ||
) | ||
|
||
type Blacklist struct { | ||
sourcelist []string // account address (b58 encoded like Am...) or id (32 bytes in hex = 64 bytes) | ||
blocked map[string]bool // all above converted to account id (32 bytes) | ||
} | ||
|
||
var globalBlacklist *Blacklist | ||
|
||
// Initialize sets up the blacklist with the given addresses. | ||
// This function should be called only once at the start. | ||
func Initialize(addresses []string) { | ||
conf := &Blacklist{} | ||
conf.sourcelist = make([]string, len(addresses)) | ||
copy(conf.sourcelist, addresses) | ||
conf.blocked = make(map[string]bool) | ||
for _, v := range addresses { | ||
key, err := toKey(v) | ||
if err == nil { | ||
conf.blocked[key] = true | ||
} else { | ||
// Handle invalid address, log or take other actions as needed | ||
} | ||
} | ||
globalBlacklist = conf | ||
} | ||
|
||
func Check(address string) bool { | ||
if globalBlacklist == nil { | ||
return false | ||
} | ||
key, err := toKey(address) | ||
if err != nil { | ||
return false | ||
} | ||
return globalBlacklist.blocked[key] | ||
} | ||
|
||
func toKey(address string) (string, error) { | ||
var key []byte | ||
var err error | ||
if len(address) == 64 { | ||
key, err = hex.Decode(address) | ||
} else { | ||
var addr []byte | ||
addr, err = types.DecodeAddress(address) | ||
if err != nil { | ||
return "", err | ||
} | ||
key = common.Hasher(addr) | ||
} | ||
return string(key), err | ||
} |
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
Oops, something went wrong.